📄 frmroom2.frm
字号:
VERSION 5.00
Begin VB.Form frmRoom2
BackColor = &H00C0C0FF&
Caption = "客房信息查询"
ClientHeight = 2820
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form4"
ScaleHeight = 2820
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton cmdExit
BackColor = &H00C0C0FF&
Caption = "取消(&X)"
Height = 615
Left = 2640
Style = 1 'Graphical
TabIndex = 5
Top = 2040
Width = 1215
End
Begin VB.CommandButton cmdOk
BackColor = &H00C0C0FF&
Caption = "确定(&O)"
Height = 615
Left = 720
Style = 1 'Graphical
TabIndex = 4
Top = 2040
Width = 1215
End
Begin VB.ComboBox Combo1
Height = 300
Left = 1800
TabIndex = 3
Top = 1320
Width = 2175
End
Begin VB.TextBox txtItem
Height = 375
Left = 1800
TabIndex = 2
Top = 480
Width = 2175
End
Begin VB.CheckBox chkItem
BackColor = &H00C0C0FF&
Caption = "客房种类:"
Height = 255
Index = 1
Left = 360
TabIndex = 1
Top = 1320
Width = 1335
End
Begin VB.CheckBox chkItem
BackColor = &H00C0C0FF&
Caption = "客房编号:"
Height = 255
Index = 0
Left = 240
TabIndex = 0
Top = 600
Width = 1215
End
End
Attribute VB_Name = "FrmRoom2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'Dim index As Integer
'用于传递查询块
Private Sub chkItem_Click(Index As Integer)
If Index = 0 Then
txtItem.SetFocus
Else
Combo1.SetFocus
End If
End Sub
Private Sub cmdExit_Click()
Me.Hide
End Sub
Private Sub cmdOK_Click()
Dim sQSql As String
If chkItem(0).Value = vbChecked Then
sQSql = " roomNO = '" & Trim(txtItem & " ") & "'"
End If
If chkItem(1).Value = vbChecked Then
If Trim(sQSql & " ") = "" Then
sQSql = " roomtype ='" & Trim(Combo1 & " ") & "'"
Else
sQSql = sQSql & " and roomtype ='" & Trim(Combo1 & " ") & "'"
End If
End If
If Trim(sQSql) = "" Then
MsgBox "请设置查询条件!", vbOKOnly + vbExclamation, "警告"
Exit Sub
Else
If flagRedit Then
Unload frmRoom
End If
frmRoom.txtSQL = "select * from rooms where" & sQSql
frmRoom.Show
frmRoom.Command1.Enabled = False
frmRoom.Command2.Enabled = False
frmRoom.Command3.Enabled = False
End If
Me.Hide
End Sub
Private Sub Form_Load()
Dim i As Integer
Dim j As Integer
Dim txtSQL As String
Dim MsgText As String
Dim mrc As ADODB.Recordset
'初始化物资名称
txtSQL = "select DISTINCT typename from roomtype"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If Not mrc.EOF Then
Do While Not mrc.EOF
Combo1.AddItem Trim(mrc.Fields(0))
mrc.MoveNext
Loop
Combo1.ListIndex = 0
Else
MsgBox "请先进行客房标准设置!", vbOKOnly + vbExclamation, "警告"
Exit Sub
End If
mrc.Close
End Sub
Private Sub lblitem_Click(Index As Integer)
chkItem(Index).Value = vbChecked
End Sub
Private Sub txtItem_GotFocus()
txtItem.SelStart = 0
txtItem.SelLength = Len(txtItem)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -