📄 frmbreakfast.frm
字号:
VERSION 5.00
Begin VB.Form frmBreakFast
Caption = "顾客使用早餐"
ClientHeight = 4680
ClientLeft = 60
ClientTop = 450
ClientWidth = 6150
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 4680
ScaleWidth = 6150
StartUpPosition = 2 'CenterScreen
Begin VB.Frame Frame3
Height = 855
Left = 960
TabIndex = 5
Top = 2760
Width = 4215
Begin VB.CommandButton Command2
Caption = "取消"
Height = 375
Left = 2760
TabIndex = 7
Top = 240
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 375
Left = 360
TabIndex = 6
Top = 240
Width = 1095
End
End
Begin VB.Frame Frame4
Caption = "早餐价格表"
Height = 2295
Left = 3240
TabIndex = 4
Top = 480
Width = 1935
Begin VB.Label Label12
AutoSize = -1 'True
Caption = "2.5"
ForeColor = &H00FF00FF&
Height = 195
Left = 1200
TabIndex = 19
Top = 1920
Width = 225
End
Begin VB.Label Label11
AutoSize = -1 'True
Caption = "2.0"
ForeColor = &H00FF00FF&
Height = 195
Left = 1200
TabIndex = 18
Top = 1590
Width = 225
End
Begin VB.Label Label10
AutoSize = -1 'True
Caption = "1.6"
ForeColor = &H00FF00FF&
Height = 195
Left = 1200
TabIndex = 17
Top = 1260
Width = 225
End
Begin VB.Label Label9
AutoSize = -1 'True
Caption = "1.2"
ForeColor = &H00FF00FF&
Height = 195
Left = 1200
TabIndex = 16
Top = 930
Width = 225
End
Begin VB.Label Label8
AutoSize = -1 'True
Caption = "1.0"
ForeColor = &H00FF00FF&
Height = 195
Left = 1200
TabIndex = 15
Top = 600
Width = 225
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "E"
ForeColor = &H00FF00FF&
Height = 195
Left = 360
TabIndex = 14
Top = 1920
Width = 105
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "D"
ForeColor = &H00FF00FF&
Height = 195
Left = 360
TabIndex = 13
Top = 1590
Width = 120
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "C"
ForeColor = &H00FF00FF&
Height = 195
Left = 360
TabIndex = 12
Top = 1260
Width = 105
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "B"
ForeColor = &H00FF00FF&
Height = 195
Left = 360
TabIndex = 11
Top = 930
Width = 105
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "A"
ForeColor = &H00FF00FF&
Height = 195
Left = 360
TabIndex = 10
Top = 600
Width = 105
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "价格(元/份)"
Height = 195
Left = 960
TabIndex = 9
Top = 360
Width = 885
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "早餐类型"
Height = 195
Left = 120
TabIndex = 8
Top = 360
Width = 720
End
End
Begin VB.Frame Frame2
Caption = "请选择早餐类型"
Height = 1215
Left = 960
TabIndex = 2
Top = 1560
Width = 2175
Begin VB.ComboBox cboBreakFast
Height = 315
ItemData = "frmBreakFast.frx":0000
Left = 240
List = "frmBreakFast.frx":0013
Style = 2 'Dropdown List
TabIndex = 3
Top = 480
Width = 1575
End
End
Begin VB.Frame Frame1
Caption = "请选择顾客房间号"
Height = 975
Left = 960
TabIndex = 0
Top = 480
Width = 2175
Begin VB.ComboBox cboRoomNo
Height = 315
Left = 240
Style = 2 'Dropdown List
TabIndex = 1
Top = 360
Width = 1695
End
End
End
Attribute VB_Name = "frmBreakFast"
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 rsPayOff As New ADODB.Recordset
Private rsRooms As New ADODB.Recordset
Private Sub Command1_Click()
Dim s As String
If cboRoomNo.Text = "" Then
MsgBox "请选择一个顾客房间号!", vbInformation, "提示"
cboRoomNo.SetFocus
Exit Sub
ElseIf cboBreakFast.Text = "" Then
MsgBox "请选择早餐类型!", vbInformation, "提示"
cboBreakFast.SetFocus
Exit Sub
End If
rsPayOff.Open "SELECT * FROM CustPayOff WHERE 顾客预定房间号='" & cboRoomNo.Text & "' AND 顾客状态='已经入住'", cnnHotel, adOpenKeyset, adLockOptimistic '打开记录集
If IsNull(rsPayOff.Fields("顾客使用早餐情况")) Then '如果字段为Null
s = ""
Else
s = rsPayOff.Fields("顾客使用早餐情况")
End If
s = s + cboBreakFast.Text
rsPayOff.Update "顾客使用早餐情况", s
rsPayOff.Close
MsgBox "顾客已经可以使用" & cboBreakFast.Text & "类早餐!"
Unload frmBreakFast
End Sub
Private Sub Command2_Click()
Unload frmBreakFast
End Sub
Private Sub Form_Load()
cnnHotel.Provider = "Microsoft.Jet.OLEDB.3.51"
cnnHotel.Open "User ID=admin;Data Source=" & GetDBPath() '建立与数据库的连接
rsRooms.Open "SELECT 房间号,房间状态 FROM Rooms WHERE 房间状态='已经入住'", cnnHotel, adOpenKeyset, adLockOptimistic '打开新记录集
Do While Not rsRooms.BOF And Not rsRooms.EOF
cboRoomNo.AddItem rsRooms.Fields("房间号") '在cboRoomNo 的下拉列表选项中加如当前的已经被预定的房间号
rsRooms.MoveNext '移到下一条记录
Loop
End Sub
Private Sub Form_Unload(Cancel As Integer)
cnnHotel.Close
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -