📄 frm_dy.frm
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form frm_dy
Caption = "大楼单元设置"
ClientHeight = 5940
ClientLeft = 3060
ClientTop = 2145
ClientWidth = 6585
LinkTopic = "Form2"
MaxButton = 0 'False
ScaleHeight = 5940
ScaleWidth = 6585
Begin VB.Data Data3
Caption = "Data3"
Connect = "Access"
DatabaseName = "D:\zhkl\db_wyfy.mdb"
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 495
Left = 4320
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "db_dy"
Top = 4440
Width = 1575
End
Begin VB.Data Data2
Caption = "Data2"
Connect = "Access"
DatabaseName = "D:\zhkl\db_wyfy.mdb"
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 375
Left = 2400
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "db_dl"
Top = 4440
Width = 1500
End
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = "D:\zhkl\db_wyfy.mdb"
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 375
Left = 600
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "db_xqmz"
Top = 4440
Width = 1575
End
Begin VB.Frame Frame4
Caption = "单元编号"
Height = 975
Left = 600
TabIndex = 9
Top = 2880
Width = 5055
Begin MSComCtl2.UpDown UpDown2
Height = 375
Left = 4320
TabIndex = 15
Top = 360
Width = 255
_ExtentX = 450
_ExtentY = 661
_Version = 393216
Enabled = -1 'True
End
Begin VB.TextBox Text2
Height = 375
Left = 3120
TabIndex = 14
Top = 360
Width = 1455
End
Begin MSComCtl2.UpDown UpDown1
Height = 375
Left = 2400
TabIndex = 12
Top = 360
Width = 255
_ExtentX = 450
_ExtentY = 661
_Version = 393216
Enabled = -1 'True
End
Begin VB.TextBox Text1
Height = 375
Left = 1200
TabIndex = 11
Text = "1"
Top = 360
Width = 1455
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "至"
Height = 180
Left = 2760
TabIndex = 13
Top = 400
Width = 180
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "单元编号:"
Height = 180
Left = 240
TabIndex = 10
Top = 400
Width = 900
End
End
Begin VB.Frame Frame3
Caption = "选择大楼"
Height = 735
Left = 600
TabIndex = 6
Top = 2040
Width = 3375
Begin VB.ComboBox Combo2
Height = 300
Left = 1200
TabIndex = 8
Top = 300
Width = 2055
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "大楼编号:"
Height = 180
Left = 240
TabIndex = 7
Top = 360
Width = 900
End
End
Begin VB.Frame Frame2
Height = 1695
Left = 4080
TabIndex = 3
Top = 1080
Width = 1575
Begin VB.CommandButton Command2
Caption = "返回主系统"
Height = 495
Left = 120
TabIndex = 5
Top = 960
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "开始生成系统"
Height = 495
Left = 120
TabIndex = 4
Top = 240
Width = 1335
End
End
Begin VB.Frame Frame1
Caption = "选择小区"
Height = 735
Left = 600
TabIndex = 1
Top = 1080
Width = 3375
Begin VB.ComboBox Combo1
Height = 300
Left = 1200
TabIndex = 18
Top = 300
Width = 2055
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "小区名称:"
Height = 180
Left = 240
TabIndex = 2
Top = 360
Width = 900
End
End
Begin VB.Label Label8
Caption = "Label8"
DataField = "物管处电话"
DataSource = "Data1"
Height = 375
Left = 4680
TabIndex = 19
Top = 5280
Width = 1215
End
Begin VB.Label Label7
Caption = "Label7"
DataField = "大楼名称"
DataSource = "Data2"
Height = 375
Left = 2880
TabIndex = 17
Top = 5280
Width = 1215
End
Begin VB.Label Label6
Caption = "Label6"
DataField = "小区名称"
DataSource = "Data1"
Height = 375
Left = 840
TabIndex = 16
Top = 5280
Width = 1695
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "大楼单元设置"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 2400
TabIndex = 0
Top = 480
Width = 1530
End
End
Attribute VB_Name = "frm_dy"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
If Combo1.Text = "" Or Combo2.Text = "" Or Text1.Text = "" Or Text2.Text = "" Then
MsgBox "你添的信息不完整,请将信息补充完整", 48, "提示"
Exit Sub
End If
Dim a, b, c, len1, len2 As Integer
Dim l, s1, s2 As String
b = Val(Text2.Text)
For a = Val(Text1.Text) To b
Data3.Refresh
If Data3.Recordset.RecordCount > 0 Then
Data3.Recordset.MoveFirst
Do While Data3.Recordset.EOF = False
If Data3.Recordset.Fields("单元名称") = Trim(Combo2.Text + Trim(Str(a)) + "单元") Then
GoTo l:
Else
Data3.Recordset.MoveNext
End If
Loop
Data3.Recordset.Fields("物管处电话") = "select 物管处电话 from db_xqmz where 小区名称 like combo1.Text"
len1 = Len(Combo1.Text)
len2 = Len(Combo2.Text)
c = len2 - len1
s1 = Right(Combo2.Text, c)
Set adors = cn.Execute("insert into db_dy(小区名称,大楼编号,大楼名称,单元名称,单元编号) values('" & Combo1.Text & "','" & s1 & "', '" & Combo2.Text & "','" & Trim(Combo2 + Trim(Str(a)) + "单元") & "','" & Trim(Str(a)) & "')")
Else
Set adors = cn.Execute("insert into db_dy(小区名称,大楼编号,大楼名称,单元名称,单元编号) values('" & Combo1.Text & "','" & s1 & "', '" & Combo2.Text & "','" & Trim(Combo2 + Trim(Str(a)) + "单元") & "','" & Trim(Str(a)) & "')")
End If
l:
Next a
MsgBox "数据保存成功", 32, "大楼栋数登记"
Data3.Refresh
End Sub
Private Sub Command2_Click()
Form1.Show
Unload Me
End Sub
Private Sub Form_Load()
Dim s1 As String
Dim s2 As String
Dim i As Integer
Dim l As Integer
Data1.Refresh
Data1.Recordset.MoveFirst
Do While Data1.Recordset.EOF = False
Combo1.AddItem Label6.Caption
Data1.Recordset.MoveNext
Loop
Data2.Refresh
Data2.Recordset.MoveFirst
Do While Data2.Recordset.EOF = False
Combo2.AddItem Label7.Caption
Data2.Recordset.MoveNext
Loop
End Sub
Private Sub UpDown1_Change()
Text1.Text = UpDown1.Value
End Sub
Private Sub UpDown2_Change()
Text2.Text = UpDown2.Value
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -