📄 frmhome.frm
字号:
VERSION 5.00
Begin VB.Form frmhome
Caption = "户口登记表"
ClientHeight = 7815
ClientLeft = 60
ClientTop = 345
ClientWidth = 9240
ControlBox = 0 'False
LinkTopic = "Form1"
MDIChild = -1 'True
ScaleHeight = 7815
ScaleWidth = 9240
WindowState = 2 'Maximized
Begin VB.Frame Frame3
Caption = "迁出信息"
Enabled = 0 'False
Height = 1215
Left = 120
TabIndex = 24
Top = 5520
Width = 9015
Begin VB.TextBox Text4
Enabled = 0 'False
Height = 375
Left = 3840
MaxLength = 150
TabIndex = 25
Top = 480
Width = 4695
End
Begin VB.Label Label20
Caption = "*"
ForeColor = &H000000FF&
Height = 135
Left = 8640
TabIndex = 36
Top = 600
Visible = 0 'False
Width = 135
End
Begin VB.Label Label14
Caption = "迁出到何地:"
Enabled = 0 'False
Height = 375
Left = 2520
TabIndex = 28
Top = 600
Width = 1095
End
Begin VB.Label Label13
Enabled = 0 'False
Height = 375
Left = 1320
TabIndex = 27
Top = 600
Width = 975
End
Begin VB.Label Label12
Caption = "迁出日期:"
Enabled = 0 'False
Height = 375
Left = 240
TabIndex = 26
Top = 600
Width = 1095
End
End
Begin VB.CommandButton Command4
Caption = "迁出此户"
Enabled = 0 'False
Height = 375
Left = 240
TabIndex = 23
Top = 4920
Width = 1455
End
Begin VB.Frame Frame5
Height = 735
Left = 2040
TabIndex = 20
Top = 2640
Width = 1695
Begin VB.OptionButton Option4
Caption = "否"
Height = 375
Left = 960
TabIndex = 22
Top = 240
Value = -1 'True
Width = 615
End
Begin VB.OptionButton Option3
Caption = "是"
Height = 375
Left = 120
TabIndex = 21
Top = 240
Width = 615
End
End
Begin VB.Frame Frame2
Caption = "迁入信息"
Enabled = 0 'False
Height = 1215
Left = 120
TabIndex = 14
Top = 3480
Width = 9015
Begin VB.TextBox Text3
Enabled = 0 'False
Height = 375
Left = 3840
MaxLength = 150
TabIndex = 18
Top = 480
Width = 4695
End
Begin VB.Label Label19
Caption = "*"
ForeColor = &H000000FF&
Height = 135
Left = 8640
TabIndex = 35
Top = 600
Visible = 0 'False
Width = 135
End
Begin VB.Label Label10
Caption = "自何地迁入:"
Enabled = 0 'False
Height = 375
Left = 2520
TabIndex = 17
Top = 600
Width = 1095
End
Begin VB.Label Label9
Enabled = 0 'False
Height = 375
Left = 1320
TabIndex = 16
Top = 600
Width = 975
End
Begin VB.Label Label8
Caption = "迁入日期:"
Enabled = 0 'False
Height = 375
Left = 240
TabIndex = 15
Top = 600
Width = 1095
End
End
Begin VB.CommandButton Command3
Caption = "下一步"
Height = 375
Left = 6240
TabIndex = 3
Top = 7200
Width = 975
End
Begin VB.CommandButton Command2
Caption = "重置"
Height = 375
Left = 4080
TabIndex = 2
Top = 7200
Width = 975
End
Begin VB.CommandButton Command1
Caption = "取消"
Height = 375
Left = 1920
TabIndex = 1
Top = 7200
Width = 975
End
Begin VB.ComboBox Combo1
Height = 300
ItemData = "frmhome.frx":0000
Left = 1680
List = "frmhome.frx":000D
Style = 2 'Dropdown List
TabIndex = 0
Top = 1080
Width = 2055
End
Begin VB.Frame Frame1
Caption = "户口登记"
Height = 2415
Left = 120
TabIndex = 4
Top = 120
Width = 9015
Begin VB.TextBox Text5
Height = 270
Left = 1560
MaxLength = 3
TabIndex = 30
Top = 360
Width = 735
End
Begin VB.TextBox Text2
Height = 375
Left = 1560
MaxLength = 150
TabIndex = 13
Top = 1800
Width = 4815
End
Begin VB.TextBox Text1
Height = 375
Left = 5400
MaxLength = 20
TabIndex = 9
Top = 960
Width = 1575
End
Begin VB.Label Label18
Caption = "*"
ForeColor = &H000000FF&
Height = 135
Left = 6600
TabIndex = 34
Top = 1920
Width = 135
End
Begin VB.Label Label17
Caption = "*"
ForeColor = &H000000FF&
Height = 135
Left = 7080
TabIndex = 33
Top = 1080
Width = 135
End
Begin VB.Label Label16
Caption = "*"
ForeColor = &H000000FF&
Height = 135
Left = 3720
TabIndex = 32
Top = 960
Width = 135
End
Begin VB.Label Label28
Caption = "*"
ForeColor = &H000000FF&
Height = 135
Left = 3720
TabIndex = 31
Top = 360
Width = 135
End
Begin VB.Label Label11
Caption = "-"
Height = 255
Left = 2400
TabIndex = 29
Top = 360
Width = 135
End
Begin VB.Label Label5
Caption = "家庭住址:"
Height = 255
Left = 240
TabIndex = 12
Top = 1920
Width = 1095
End
Begin VB.Label Label7
Height = 255
Left = 5400
TabIndex = 11
Top = 360
Width = 2535
End
Begin VB.Label Label6
Caption = "登记日期:"
Height = 255
Left = 4080
TabIndex = 10
Top = 360
Width = 1095
End
Begin VB.Label Label4
Caption = "户主姓名:"
Height = 255
Left = 4080
TabIndex = 8
Top = 1080
Width = 975
End
Begin VB.Label Label1
Caption = "户别:"
Height = 255
Left = 240
TabIndex = 7
Top = 1080
Width = 855
End
Begin VB.Label Label3
BorderStyle = 1 'Fixed Single
Height = 255
Left = 2640
TabIndex = 6
Top = 360
Width = 975
End
Begin VB.Label Label2
Caption = "户号:"
Height = 255
Left = 240
TabIndex = 5
Top = 360
Width = 855
End
End
Begin VB.Label Label15
Caption = "此户是否为迁入户"
Height = 255
Left = 240
TabIndex = 19
Top = 2880
Width = 1575
End
End
Attribute VB_Name = "frmhome"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Unload frmhome
Unload frmpeople
'初始化主窗口
mainfrm.guanli.Enabled = True
mainfrm.chaxun.Enabled = True
mainfrm.tongji.Enabled = True
If userid = "admin" Then
mainfrm.xitong.Enabled = True
mainfrm.bdb.Enabled = True
Else
mainfrm.xitong.Enabled = False
mainfrm.bdb.Enabled = False
End If
mainfrm.Command1.Enabled = True
mainfrm.Command2.Enabled = True
mainfrm.Command3.Enabled = True
If userid = "admin" Then
mainfrm.Command4.Enabled = True
Else
mainfrm.Command4.Enabled = False
End If
GetStatus "<就绪>"
End Sub
Private Sub Command2_Click()
Unload frmhome '数据重置
frmhome.Show
End Sub
Private Sub Command3_Click()
'检查项目是否为空
Dim thuhao As String
If Text5.Text = "" Then
MsgBox "请输入户号前缀"
Text5.SetFocus
Else
thuhao = Trim(Text5.Text) & Label11.Caption & Label3.Caption
Set cnn = New ADODB.Connection
Set ret = New ADODB.Recordset
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path & "\data\db.mdb" + ";Persist Security Info=False;" '检查户号是否重复
local_db = "select 户主姓名 from 户口表" + _
" where 户口表.户号=" + "'" + thuhao + "'"
ret.Open local_db, cnn
If Not (ret.BOF And ret.EOF) Then
MsgBox "此户号已存在,点击确定后系统会自动生成新的户号尾数", , "警告"
Unload frmhome
frmhome.Show
Else
If Combo1.Text = "" Then
MsgBox "请选择户别", , "警告"
Else
If Text1.Text = "" Then
MsgBox "请输入户主姓名", , "警告"
Text1.SetFocus
Else
If Text2.Text = "" Then
MsgBox "请输入家庭住址", , "警告"
Text2.SetFocus
Else
If Option3.Value = True And Text3.Text = "" Then
MsgBox "请输入由何地迁入", , "警告"
Text3.SetFocus
End If
End If
End If
End If
End If
End If
'不含迁入信息时判定
If Option3.Value = False Then
If Text5.Text <> "" And Combo1.Text <> "" And Text1.Text <> "" And Text2.Text <> "" Then
frmhome.Hide
frmpeople.Show
tyhuhao1 = Trim(Text5.Text)
tyhuhao2 = Label3.Caption
frmpeople.Label2.Caption = tyhuhao1
frmpeople.Label4.Caption = tyhuhao2
frmpeople.Text9.Text = Trim(Text1.Text)
End If
'含迁入信息时判定
Else
If Text5.Text <> "" And Combo1.Text <> "" And Text1.Text <> "" And Text2.Text <> "" _
And Text3.Text <> "" Then
frmhome.Hide
frmpeople.Show
tyhuhao1 = Trim(Text5.Text)
tyhuhao2 = Label3.Caption
frmpeople.Label2.Caption = tyhuhao1
frmpeople.Label4.Caption = tyhuhao2
frmpeople.Text9.Text = Trim(Text1.Text)
End If
End If
End Sub
Private Sub Form_Load()
'生成户号尾数
Dim t As String, d As String
Dim s1 As String, s2 As String, s3 As String, s4 As String
Label7.Caption = Date
t = Time
d = Date
s1 = Right(d, 1) '取系统时间数字
s2 = Left(t, 1)
s3 = Right(t, 2)
s4 = Int(Rnd * 100) '取两位随机数
Label3.Caption = s4 & s1 & s2 & s3
End Sub
Private Sub Option3_Click()
'激活迁入信息选项
Label9.Caption = Date
Frame2.Enabled = True
Label8.Enabled = True
Label9.Enabled = True
Label10.Enabled = True
Text3.Enabled = True
Label19.Visible = True
Text3.SetFocus
End Sub
Private Sub Option4_Click()
'屏蔽迁入信息选项
Label9.Caption = ""
Frame2.Enabled = False
Label8.Enabled = False
Label9.Enabled = False
Label10.Enabled = False
Text3.Enabled = False
Label19.Visible = False
Text3.Text = ""
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -