📄 frmczhuzhi.frm
字号:
VERSION 5.00
Begin VB.Form frmczhuzhi
BorderStyle = 1 'Fixed Single
Caption = "查询住址"
ClientHeight = 5325
ClientLeft = 45
ClientTop = 330
ClientWidth = 4680
ControlBox = 0 'False
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 5325
ScaleWidth = 4680
Begin VB.CommandButton Command2
Caption = "查询"
Height = 375
Left = 1800
TabIndex = 3
Top = 2160
Width = 855
End
Begin VB.Frame Frame1
Caption = "查询住址"
Height = 5055
Left = 120
TabIndex = 0
Top = 120
Width = 4455
Begin VB.TextBox Text4
Enabled = 0 'False
Height = 1095
Left = 120
MultiLine = -1 'True
TabIndex = 11
Top = 3120
Width = 4215
End
Begin VB.Frame Frame2
Height = 1575
Left = 120
TabIndex = 4
Top = 240
Width = 4215
Begin VB.TextBox Text1
Enabled = 0 'False
Height = 270
Left = 1800
MaxLength = 3
TabIndex = 9
Top = 360
Width = 615
End
Begin VB.TextBox Text2
Enabled = 0 'False
Height = 270
Left = 2760
MaxLength = 10
TabIndex = 8
Top = 360
Width = 1335
End
Begin VB.TextBox Text3
Enabled = 0 'False
Height = 270
Left = 1800
MaxLength = 22
TabIndex = 7
Top = 1080
Width = 2295
End
Begin VB.OptionButton Option2
Caption = "按照身份证号:"
Height = 255
Left = 120
TabIndex = 6
Top = 1080
Width = 1575
End
Begin VB.OptionButton Option1
Caption = "按照户号:"
Height = 255
Left = 120
TabIndex = 5
Top = 360
Width = 1335
End
Begin VB.Label Label1
Caption = "-"
Height = 255
Left = 2520
TabIndex = 10
Top = 360
Width = 135
End
End
Begin VB.CommandButton Command1
Caption = "关闭"
Height = 375
Left = 1680
TabIndex = 2
Top = 4440
Width = 855
End
Begin VB.Label Label2
Caption = "此户(人)的住址为:"
Height = 375
Left = 120
TabIndex = 1
Top = 2760
Width = 1935
End
End
End
Attribute VB_Name = "frmczhuzhi"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
Unload frmczhuzhi
'初始化主窗口
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()
Dim flagtmp As Integer
Dim cnn As New ADODB.Connection
Dim ret As New ADODB.Recordset
Dim local_db As String
If Option1.Value = False And Option2.Value = False Then
MsgBox "请选择查询方式", , "警告"
Else
If Option1.Value = True And Option2.Value = False Then
If Text1.Text = "" Or Text2.Text = "" Then
MsgBox "户号未输入或格式不正确", , "警告"
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
End If
Else
If Option1.Value = False And Option2.Value = True Then
If Text3.Text = "" Then
MsgBox "请输入身份证号", , "警告"
Text3.SetFocus
End If
End If
End If
End If
If Option1.Value <> False Or Option2.Value <> False Then
If Option1.Value = True And Option2.Value = False Then
If Text1.Text <> "" And Text2.Text <> "" Then
flagtmp = 1
End If
End If
End If
If Option1.Value <> False Or Option2.Value <> False Then
If Option1.Value = False And Option2.Value = True Then
If Text3.Text <> "" Then
flagtmp = 1
End If
End If
End If
If flagtmp = 1 Then
If Option1.Value = True And Option2.Value = False Then
Dim huhao As String
huhao = Trim(Text1.Text) & Label1.Caption & Trim(Text2.Text)
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 户口表.户号=" + "'" + huhao + "'"
ret.Open local_db, cnn
If ret.BOF And ret.EOF Then
MsgBox "此户号不存在", , "警告"
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
Else
Text4.Text = ret("住址")
End If
End If
If Option1.Value = False And Option2.Value = True Then
Dim sf As String
Dim thuhao As String
sf = Trim(Text3.Text)
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 人口表.身份证号=" + "'" + sf + "'"
ret.Open local_db, cnn
If ret.BOF And ret.EOF Then
MsgBox "无此身份证号", , "警告"
Text3.Text = ""
Text3.SetFocus
Else
thuhao = ret("户号")
ret.Close
cnn.Close
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
Text4.Text = ret("住址")
End If
End If
End If
End Sub
Private Sub Option1_Click()
Text1.Enabled = True
Text2.Enabled = True
Text3.Enabled = False
Text3.Text = ""
Text4.Text = ""
End Sub
Private Sub Option2_Click()
Text3.Enabled = True
Text1.Enabled = False
Text2.Enabled = False
Text1.Text = ""
Text2.Text = ""
Text4.Text = ""
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -