📄 frmsearch.frm
字号:
VERSION 5.00
Begin VB.Form FrmSearch
BorderStyle = 3 'Fixed Dialog
Caption = "登记查询"
ClientHeight = 1710
ClientLeft = 45
ClientTop = 330
ClientWidth = 5325
Icon = "FrmSearch.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1710
ScaleWidth = 5325
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.PictureBox CmdExit
Height = 495
Index = 0
Left = 3720
ScaleHeight = 435
ScaleWidth = 1275
TabIndex = 4
ToolTipText = "关闭"
Top = 960
Width = 1335
End
Begin VB.PictureBox CmdSearch
Height = 495
Left = 3720
ScaleHeight = 435
ScaleWidth = 1275
TabIndex = 5
ToolTipText = "查询"
Top = 240
Width = 1335
End
Begin VB.TextBox txt_Value
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1320
TabIndex = 1
Top = 960
Width = 1935
End
Begin VB.ComboBox cmb_Field
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 1320
TabIndex = 0
Top = 360
Width = 1935
End
Begin VB.Shape Shape1
Height = 1695
Left = 0
Top = 0
Width = 5295
End
Begin VB.Label Label3
Caption = "输入数值:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 240
TabIndex = 3
Top = 1080
Width = 1095
End
Begin VB.Label Label2
Caption = "查询字段:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 240
TabIndex = 2
Top = 480
Width = 1095
End
End
Attribute VB_Name = "FrmSearch"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs As ADODB.Recordset
Dim sqlstr, msgstr As String
Private Sub CmdExit_Click(Index As Integer)
Unload Me
End Sub
Private Sub CmdSearch_Click()
If rights = 2 Then
MsgBox "对不起,你没有此权限!", vbInformation, "警告"
Exit Sub
End If
FrmDengJ.Show
sqlstr = "select a.姓名,a.性别,a.电话号码,a.身份证,b.客房编号,b.客房类型,b.客房单价,b.床位,a.实住床位,a.剩余床位,a.住宿日期,a.预收押金,a.备注 from accomm_info a,guestroom_info b where a.客房编号=b.客房编号 and a."
If (cmb_Field.Text = "姓名") Or (cmb_Field.Text = "性别") Then
sqlstr = sqlstr & cmb_Field.Text & "='" & txt_Value.Text & "'"
End If
If (cmb_Field.Text = "电话号码") Or (cmb_Field.Text = "身份证") Then
sqlstr = sqlstr & cmb_Field.Text & "='" & txt_Value.Text & "'"
End If
If (cmb_Field.Text = "客房编号") Or (cmb_Field.Text = "备注") Then
sqlstr = sqlstr & cmb_Field.Text & "='" & txt_Value.Text & "'"
End If
If cmb_Field.Text = "住宿日期" Then
sqlstr = sqlstr & cmb_Field.Text & "=CDate('" & txt_Value.Text & "')"
End If
Set rs = ExecuteSQL(sqlstr, msgstr)
If rs.EOF Then
MsgBox "数值不对,请重新输入", vbInformation, ""
txt_Value.Text = ""
FrmSearch.Show
Exit Sub
Else
FrmDengJ.tabDengJ.Clear
FrmDengJ.tabDengJ.ClearStructure
FrmDengJ.tabDengJ.Rows = rs.RecordCount + 1
FrmDengJ.tabDengJ.Row = 0
With FrmDengJ.tabDengJ
.Cols = 13
.TextMatrix(0, 0) = "姓名"
.TextMatrix(0, 1) = "性别"
.TextMatrix(0, 2) = "电话号码"
.TextMatrix(0, 3) = "身份证"
.TextMatrix(0, 4) = "客房编号"
.TextMatrix(0, 5) = "客房类型"
.TextMatrix(0, 6) = "客房单价"
.TextMatrix(0, 7) = "床位"
.TextMatrix(0, 8) = "实住床位"
.TextMatrix(0, 9) = "剩余床位"
.TextMatrix(0, 10) = "住宿日期"
.TextMatrix(0, 11) = "预收押金"
.TextMatrix(0, 12) = "备注"
End With
i = 0
Do While Not rs.EOF
i = i + 1
FrmDengJ.tabDengJ.Row = i
For j = 0 To 12
FrmDengJ.tabDengJ.Col = j
If IsNull(rs.Fields(j)) Then
FrmDengJ.tabDengJ.TextMatrix(i, j) = ""
Else
FrmDengJ.tabDengJ.TextMatrix(i, j) = rs.Fields(j)
End If
Next j
rs.MoveNext
Loop
End If
rs.Close
Set rs = Nothing
Unload Me
End Sub
Private Sub Form_Load()
cmb_Field.AddItem "姓名"
cmb_Field.AddItem "性别"
cmb_Field.AddItem "电话号码"
cmb_Field.AddItem "身份证"
cmb_Field.AddItem "客房编号"
cmb_Field.AddItem "住宿日期"
cmb_Field.AddItem "备注"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -