📄 frmcustclass.frm
字号:
VERSION 5.00
Begin VB.Form frmCustClass
BorderStyle = 3 'Fixed Dialog
Caption = "请选择客户类型"
ClientHeight = 2880
ClientLeft = 4350
ClientTop = 4080
ClientWidth = 5805
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2880
ScaleWidth = 5805
ShowInTaskbar = 0 'False
StartUpPosition = 2 'CenterScreen
Visible = 0 'False
Begin VB.CommandButton cmdCancel
Caption = "取消(&C)"
Height = 375
Left = 3120
TabIndex = 5
Top = 2160
Width = 1215
End
Begin VB.CommandButton cmdOk
Caption = "确定(&O)"
Height = 375
Left = 1320
TabIndex = 4
Top = 2160
Width = 1215
End
Begin VB.Frame Frame1
Height = 735
Left = 240
TabIndex = 1
Top = 720
Width = 5175
Begin VB.OptionButton optUnReserved
Caption = "未预定房间的客户"
Height = 375
Left = 2880
TabIndex = 3
Top = 250
Width = 1815
End
Begin VB.OptionButton optReserved
Caption = "已经预定房间的客户"
Height = 375
Left = 240
TabIndex = 2
Top = 240
Width = 1935
End
End
Begin VB.Label Label2
BeginProperty Font
Name = "Microsoft Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000C0&
Height = 240
Left = 240
TabIndex = 6
Top = 1560
Visible = 0 'False
Width = 5205
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "请选择要入住房间的客户类型:"
Height = 195
Left = 240
TabIndex = 0
Top = 480
Width = 2385
End
End
Attribute VB_Name = "frmCustClass"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private cnnHotel As New ADODB.Connection
Private rsCustReserveInfo As New ADODB.Recordset
Private rsRooms As New ADODB.Recordset
Private Sub cmdCancel_Click()
Unload frmCustClass
End Sub
Private Sub cmdOk_Click()
If optReserved.Value Then '如果顾客类型为已经预定房间的顾客
CustClass = "Reserved"
Else '如果顾客类型没有预定房间的顾客
CustClass = "UnReserved"
End If
Unload frmCustClass
If CustClass = "Reserved" Then
frmUseReservedRoom.Show 1 '显示客户入住房间窗口
ElseIf CustClass = "UnReserved" Then
frmUseUnReservedRoom.Show 1
End If
End Sub
Private Sub Form_Load()
cnnHotel.Provider = "Microsoft.Jet.OLEDB.3.51"
cnnHotel.Open "User ID=admin;Data Source=" & GetDBPath() '建立与数据库的连接
rsCustReserveInfo.Open "SELECT * FROM CustReserveInfo", cnnHotel, adOpenKeyset, adLockOptimistic '打开记录集
rsRooms.Open "SELECT 房间状态 FROM Rooms WHERE 房间状态='空闲'", cnnHotel, adOpenKeyset, adLockOptimistic '打开新记录集
If (rsCustReserveInfo.BOF Or rsCustReserveInfo.EOF) And (rsRooms.BOF Or rsRooms.EOF) Then '如果当前既没有顾客预定信息也没有空闲房间
optReserved.Enabled = False
optReserved.Enabled = False
Label2.Caption = "提示:当前无顾客预定房间,且当前没有空闲房间"
Label2.Visible = True
ElseIf rsCustReserveInfo.BOF Or rsCustReserveInfo.EOF Then '如果没有预定信息
optReserved.Enabled = False
optUnReserved.Value = True
Label2.Caption = "提示:当前无顾客预定房间"
Label2.Visible = True
ElseIf rsRooms.BOF Or rsRooms.EOF Then '如果没有空闲房间
optReserved.Enabled = False
Label2.Caption = "提示:当前无空闲房间"
Label2.Visible = True
End If
cnnHotel.Close
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -