📄 sourcecode.txt
字号:
If txtName1 = "" Or _
txtAddress1 = "" Or _
txtAge1 = "" Or _
txtNationality1 = "" Then
MsgBox "Please fill in the form properly", vbInformation, "Form Error"
txtName1.SetFocus
Exit Sub
Else
lblDateReserved1 = Format(Date, "mmmm dd, yyyy")
With dtStatus1.Recordset
.Index = "seeker"
.Seek "=", "4"
End With
If dtStatus1.Recordset.NoMatch = False Then
dtStatus1.Recordset.Edit
With dtStatus1.Recordset
.Fields("Name") = txtName1
.Fields("Address") = txtAddress1
.Fields("Age") = txtAge1
.Fields("Nationality") = txtNationality1
.Fields("DateReserved") = lblDateReserved1
.Fields("Gender") = cmdGender1
.Fields("Status") = "R"
.Fields("DateIn") = ""
.Fields("DateOut") = ""
.Fields("I") = ""
.Fields("Charge") = "0.0"
.Fields("DaysIncurred") = ""
End With
dtStatus1.Recordset.Update
Timer1.Enabled = True
frmRooms.Timer1.Enabled = True
End If
End If
'***** Check In *****
Case 2
If txtName1 = "" Or _
txtAddress1 = "" Or _
txtAge1 = "" Or _
txtNationality1 = "" Then
MsgBox "Please fill in the form properly", vbInformation, "Form Error"
txtName1.SetFocus
Exit Sub
Else
With dtStatus1.Recordset
.Index = "seeker"
.Seek "=", "4"
End With
If dtStatus1.Recordset.NoMatch = False Then
lblDateIn1 = Format(Date, "mmmm dd, yyyy")
dtStatus1.Recordset.Edit
With dtStatus1.Recordset
.Fields("Name") = txtName1
.Fields("Address") = txtAddress1
.Fields("Age") = txtAge1
.Fields("Nationality") = txtNationality1
.Fields("DateReserved") = lblDateReserved1
.Fields("Gender") = cmdGender1
.Fields("Status") = "U"
.Fields("DateIn") = lblDateIn1
.Fields("DateOut") = ""
.Fields("I") = Format(Date, "dd")
.Fields("Charge") = "0.0"
.Fields("DaysIncurred") = ""
End With
dtStatus1.Recordset.Update
Timer1.Enabled = True
frmRooms.Timer1.Enabled = True
End If
End If
'***** Check Out *****
Case 3
With dtStatus1.Recordset
.Index = "seeker"
.Seek "=", "4"
End With
If dtStatus1.Recordset.NoMatch = False Then
lblDateOut1 = Format(Date, "mmmm dd, yyyy")
o4 = Format(Date, "dd")
With dtStatus1.Recordset
i4 = .Fields("I")
End With
c4 = o4 - i4
With Data2.Recordset
.Index = "seeker"
.Seek "=", "StandardDouble"
End With
If Data2.Recordset.NoMatch = False Then
With Data2.Recordset
rSD = .Fields("PerDay")
End With
End If
If c4 = 0 Then
c4 = rSD
lblDaysIncurred1 = 1
Else
lblDaysIncurred1 = c4
c4 = c4 * rSD
End If
lblCharge1 = c4
dtStatus1.Recordset.Edit
With dtStatus1.Recordset
.Fields("Name") = txtName1
.Fields("Address") = txtAddress1
.Fields("Age") = txtAge1
.Fields("Gender") = cmdGender1
.Fields("Nationality") = txtNationality1
.Fields("DateReserved") = lblDateReserved1
.Fields("DateIn") = lblDateIn1
.Fields("DateOut") = lblDateOut1
.Fields("DaysIncurred") = lblDaysIncurred1
.Fields("Charge") = c4
.Fields("Status") = "O"
End With
dtStatus1.Recordset.Update
Data1.Recordset.AddNew
With Data1.Recordset
.Fields("RoomNUmber") = "1"
.Fields("RoomType") = "Standard [Double]"
.Fields("Name") = txtName1
.Fields("Address") = txtAddress1
.Fields("Age") = txtAge1
.Fields("Gender") = cmdGender1
.Fields("Nationality") = txtNationality1
.Fields("DateReserved") = lblDateReserved1
.Fields("DateIn") = lblDateIn1
.Fields("DateOut") = lblDateOut1
.Fields("DaysIncurred") = lblDaysIncurred1
.Fields("RatePerDay") = rSD
.Fields("Charge") = c4
End With
Data1.Recordset.Update
Timer1.Enabled = True
frmRooms.Timer1.Enabled = True
End If
'***** New *****
Case 4
frRoom1.Enabled = True
Toolbar1.Buttons(1).Enabled = True
Toolbar1.Buttons(2).Enabled = True
Toolbar1.Buttons(4).Enabled = False
Toolbar1.Buttons(5).Enabled = True
txtName1.SetFocus
With dtStatus1.Recordset
.Index = "seeker"
.Seek "=", "4"
End With
If dtStatus1.Recordset.NoMatch = False Then
dtStatus1.Recordset.Edit
With dtStatus1.Recordset
.Fields("Name") = ""
.Fields("Address") = ""
.Fields("Age") = ""
.Fields("Gender") = "Male"
.Fields("Nationality") = ""
.Fields("DateReserved") = ""
.Fields("DateIn") = ""
.Fields("DateOut") = ""
.Fields("DaysIncurred") = ""
.Fields("Charge") = "0.0"
.Fields("I") = ""
.Fields("Status") = "A"
End With
dtStatus1.Recordset.Update
With dtStatus1.Recordset
txtName1 = .Fields("Name")
txtAddress1 = .Fields("Address")
txtAge1 = .Fields("Age")
cmdGender1 = .Fields("Gender")
txtNationality1 = .Fields("Nationality")
lblDateReserved1 = .Fields("DateReserved")
lblDateIn1 = .Fields("DateIn")
lblDateOut1 = .Fields("DateOut")
lblDaysIncurred1 = ""
lblCharge1 = .Fields("Charge")
End With
End If
'****** Cancel *****
Case 5
With dtStatus1.Recordset
.Index = "seeker"
.Seek "=", "4"
End With
If dtStatus1.Recordset.NoMatch = False Then
dtStatus1.Recordset.Edit
With dtStatus1.Recordset
.Fields("Name") = ""
.Fields("Address") = ""
.Fields("Age") = ""
.Fields("Gender") = "Male"
.Fields("Nationality") = ""
.Fields("DateReserved") = ""
.Fields("DateIn") = ""
.Fields("I") = ""
.Fields("Status") = "A"
.Fields("DaysIncurred") = ""
.Fields("DateOut") = ""
.Fields("Charge") = "0.0"
End With
dtStatus1.Recordset.Update
With dtStatus1.Recordset
txtName1 = .Fields("Name")
txtAddress1 = .Fields("Address")
txtAge1 = .Fields("Age")
cmdGender1 = .Fields("Gender")
txtNationality1 = .Fields("Nationality")
lblDateReserved1 = .Fields("DateReserved")
lblDateIn1 = .Fields("DateIn")
lblDateOut1 = .Fields("DateOut")
lblDaysIncurred1 = .Fields("DaysIncurred")
lblCharge1 = .Fields("Charge")
End With
Timer1.Enabled = True
frmRooms.Timer1.Enabled = True
End If
'***** Exit *****
Case 6
Unload Me
End Select
End Sub
Private Sub Toolbar2_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Index
'***** Reserve *****
Case 1
If txtName2 = "" Or _
txtAddress2 = "" Or _
txtAge2 = "" Or _
txtNationality2 = "" Then
MsgBox "Please fill in the form properly", vbInformation, "Form Error"
txtName2.SetFocus
Exit Sub
Else
lblDateReserved2 = Format(Date, "mmmm dd, yyyy")
With dtStatus2.Recordset
.Index = "seeker"
.Seek "=", "5"
End With
If dtStatus2.Recordset.NoMatch = False Then
dtStatus2.Recordset.Edit
With dtStatus2.Recordset
.Fields("Name") = txtName2
.Fields("Address") = txtAddress2
.Fields("Age") = txtAge2
.Fields("Nationality") = txtNationality2
.Fields("DateReserved") = lblDateReserved2
.Fields("Gender") = cmdGender2
.Fields("Status") = "R"
.Fields("DateIn") = ""
.Fields("DateOut") = ""
.Fields("I") = ""
.Fields("Charge") = "0.0"
.Fields("DaysIncurred") = ""
End With
dtStatus2.Recordset.Update
Timer1.Enabled = True
frmRooms.Timer1.Enabled = True
End If
End If
'***** Check In *****
Case 2
If txtName2 = "" Or _
txtAddress2 = "" Or _
txtAge2 = "" Or _
txtNationality2 = "" Then
MsgBox "Please fill in the form properly", vbInformation, "Form Error"
txtName2.SetFocus
Exit Sub
Else
With dtStatus2.Recordset
.Index = "seeker"
.Seek "=", "5"
End With
If dtStatus2.Recordset.NoMatch = False Then
lblDateIn2 = Format(Date, "mmmm dd, yyyy")
dtStatus2.Recordset.Edit
With dtStatus2.Recordset
.Fields("Name") = txtName2
.Fields("Address") = txtAddress2
.Fields("Age") = txtAge2
.Fields("Nationality") = txtNationality2
.Fields("DateReserved") = lblDateReserved2
.Fields("Gender") = cmdGender2
.Fields("Status") = "U"
.Fields("DateIn") = lblDateIn2
.Fields("DateOut") = ""
.Fields("I") = Format(Date, "dd")
.Fields("Charge") = "0.0"
.Fields("DaysIncurred") = ""
End With
dtStatus2.Recordset.Update
Timer1.Enabled = True
frmRooms.Timer1.Enabled = True
End If
End If
'***** Check Out *****
Case 3
With dtStatus2.Recordset
.Index = "seeker"
.Seek "=", "5"
End With
If dtStatus2.Recordset.NoMatch = False Then
lblDateOut2 = Format(Date, "mmmm dd, yyyy")
o5 = Format(Date, "dd")
With dtStatus2.Recordset
i5 = .Fields("I")
End With
c5 = o5 - i5
With Data2.Recordset
.Index = "seeker"
.Seek "=", "StandardDouble"
End With
If Data2.Recordset.NoMatch = False Then
With Data2.Recordset
rSD = .Fields("PerDay")
End With
End If
If c5 = 0 Then
c5 = rSD
lblDaysIncurred2 = 1
Else
lblDaysIncurred2 = c5
c5 = c5 * rSD
End If
lblCharge2 = c5
dtStatus2.Recordset.Edit
With dtStatus2.Recordset
.Fields("Name") = txtName2
.Fields("Address") = txtAddress2
.Fields("Age") = txtAge2
.Fields("Gender") = cmdGender2
.Fields("Nationality") = txtNationality2
.Fields("DateReserved") = lblDateReserved2
.Fields("DateIn") = lblDateIn2
.Fields("DateOut") = lblDateOut2
.Fields("DaysIncurred") = lblDaysIncurred2
.Fields("Charge") = c5
.Fields("Status") = "O"
End With
dtStatus2.Recordset.Update
Data1.Recordset.AddNew
With Data1.Recordset
.Fields("RoomNUmber") = "2"
.Fields("RoomType") = "Standard [Double]"
.Fields("Name") = txtName2
.Fields("Address") = txtAddress2
.Fields("Age") = txtAge2
.Fields("Gender") = cmdGender2
.Fields("Nationality") = txtNationality2
.Fields("DateReserved") = lblDateReserved2
.Fields("DateIn") = lblDateIn2
.Fields("DateOut") = lblDateOut2
.Fields("DaysIncurred") = lblDaysIncurred2
.Fields("RatePerDay") = rSD
.Fields("Charge") = c5
End With
Data1.Recordset.Update
Timer1.Enabled = True
frmRooms.Timer1.Enabled = True
End If
'***** New *****
Case 4
frRoom2.Enabled = True
Toolbar2.Buttons(1).Enabled = True
Toolbar2.Buttons(2).Enabled = True
Toolbar2.Buttons(4).Enabled = False
Toolbar2.Buttons(5).Enabled = True
txtName2.SetFocus
With dtStatus2.Recordset
.Index = "seeker"
.Seek "=", "5"
End With
If dtStatus2.Recordset.NoMatch = False Then
dtStatus2.Recordset.Edit
With dtStatus2.Recordset
.Fields("Name") = ""
.Fields("Address") = ""
.Fields("Age") = ""
.Fields("Gender") = "Male"
.Fields("Nationality") = ""
.Fields("DateReserved") = ""
.Fields("DateIn") = ""
.Fields("DateOut") = ""
.Fields("DaysIncurred") = ""
.Fields("Charge") = "0.0"
.Fields("I") = ""
.Fields("Status") = "A"
End With
dtStatus2.Recordset.Update
With dtStatus2.Recordset
txtName2 = .Fields("Name")
txtAddress2 = .Fields("Address")
txtAge2 = .Fields("Age")
cmdGender2 = .Fields("Gender")
txtNationality2 = .Fields("Nationality")
lblDateReserved2 = .Fields("DateReserved")
lblDateIn2 = .Fields("DateIn")
lblDateOut2 = .Fields("DateOut")
lblDaysIncurred2 = ""
lblCharge2 = .Fields("Charge")
End With
End If
'****** Cancel *****
Case 5
With dtStatus2.Recordset
.Index = "seeker"
.Seek "=", "5"
End With
If dtStatus2.Recordset.NoMatch = False Then
dtStatus2.Recordset.Edit
With dtStatus2.Recordset
.Fields("Name") = ""
.Fields("Address") = ""
.Fields("Age") = ""
.Fields("Gender") = "Male"
.Fields("Nationality") = ""
.Fields("DateReserved") = ""
.Fields("DateIn") = ""
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -