📄 frm_yezhu_query.frm
字号:
VERSION 5.00
Begin VB.Form Frm_yezhu_query
BorderStyle = 1 'Fixed Single
Caption = "业主查询"
ClientHeight = 1695
ClientLeft = 4185
ClientTop = 3330
ClientWidth = 3060
Icon = "Frm_yezhu_query.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1695
ScaleWidth = 3060
StartUpPosition = 1 '所有者中心
Begin VB.ComboBox Combo1
Height = 300
Left = 1080
Style = 2 'Dropdown List
TabIndex = 4
Top = 180
Width = 1755
End
Begin VB.TextBox Text1
Height = 300
Left = 1080
TabIndex = 2
Top = 600
Width = 1755
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 375
Left = 300
TabIndex = 1
Top = 1140
Width = 975
End
Begin VB.CommandButton Command2
Cancel = -1 'True
Caption = "取消"
Height = 375
Left = 1680
TabIndex = 0
Top = 1140
Width = 975
End
Begin VB.Label Label2
Caption = "查询内容"
Height = 195
Left = 180
TabIndex = 5
Top = 600
Width = 855
End
Begin VB.Label Label1
Caption = "查询条件"
Height = 255
Left = 180
TabIndex = 3
Top = 180
Width = 735
End
End
Attribute VB_Name = "Frm_yezhu_query"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim cn As ADODB.Connection
On Error GoTo myerr
Dim rst As New ADODB.Recordset
Dim sql As String
Dim lt As ListItem
Set cn = GetCn
If Combo1 = "房号" Then
sql = "select b.fh,a.xm,a.sfz,a.zy,a.dh,a.id from yezhu a inner join fangchan b on a.fid=b.id where b.fh='" & Trim(Text1) & "' order by 1"
Else
sql = "select b.fh,a.xm,a.sfz,a.zy,a.dh,a.id from yezhu a inner join fangchan b on a.fid=b.id where a.xm like '%" & Trim(Text1) & "%' order by 1"
End If
rst.Open sql, cn, 0, 1
Frm_yezhu.ListView1.ListItems.Clear
If rst.BOF And rst.EOF Then
MsgBox "没有符合条件的记录!", vbExclamation, "提示"
Exit Sub
End If
Do While Not rst.EOF
Set lt = Frm_yezhu.ListView1.ListItems.Add(, , rst(0), 8, 8)
For i = 1 To rst.Fields.Count - 1
lt.SubItems(i) = Trim(rst(i) & "")
Next i
rst.MoveNext
Loop
rst.Close
cn.Close
Unload Me
Exit Sub
myerr:
If Err = -2147217904 Then
If rst.State = 1 Then rst.Close
rst.Open "select count(*) from yezhu", cn, 0, 1
If rst(0) = 0 Then
Unload Me
Exit Sub
Else
MsgBox Error, vbExclamation, "提示"
End If
Else
MsgBox Error, vbExclamation, "提示"
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Combo1.Clear
Combo1.AddItem "房号"
Combo1.AddItem "姓名"
Combo1.ListIndex = 0
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -