📄 frmresadd.frm
字号:
ForeColor = &H00000000&
Height = 240
Left = 5160
TabIndex = 22
Top = 1800
Width = 510
End
Begin VB.Label Label22
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Estimated Arrival"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 240
Left = 5160
TabIndex = 21
Top = 4680
Width = 1845
End
Begin VB.Label Label21
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Phone"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 240
Left = 5160
TabIndex = 20
Top = 3960
Width = 675
End
Begin VB.Label Label20
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Address"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 240
Left = 5160
TabIndex = 19
Top = 3240
Width = 885
End
Begin VB.Label Label19
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Name"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 240
Left = 5160
TabIndex = 18
Top = 2520
Width = 630
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Room Type"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 240
Left = 5160
TabIndex = 17
Top = 8280
Width = 1230
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Age"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 240
Left = 5160
TabIndex = 16
Top = 5400
Width = 435
End
Begin VB.Label Label4
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Sex"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 240
Left = 5160
TabIndex = 15
Top = 7560
Width = 405
End
Begin VB.Label Label9
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "City"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 240
Left = 5160
TabIndex = 14
Top = 6120
Width = 405
End
Begin VB.Label Label11
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Pincode"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 240
Left = 5160
TabIndex = 13
Top = 6840
Width = 870
End
End
Attribute VB_Name = "frmResAdd"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim adoConn As ADODB.Connection
Dim adoRes As ADODB.Recordset
Dim errmsg As String
Private Sub cmdExit_Click()
If MsgBox("Are you sure you want to exit Hotel Mangement Sytem ?", vbQuestion + vbYesNo, "Confirm Exit !") = vbYes Then
End
End If
End Sub
Private Sub cmdRback_Click()
If adoRes.EditMode = adEditInProgress Then
If MsgBox("All unsaved changes would be lost.Proceed anyway?") = vbYes Then
adoRes.CancelUpdate
Else
adoRes.Update
End If
End If
MsgBox "Now exiting from application", vbInformation
Set adoRes = Nothing
Set adoConn = Nothing
frmResAdd.Visible = False
frmMain.Show
End Sub
Private Sub Image3_Click()
If adoRes.EditMode = adEditInProgress Then
If MsgBox("All unsaved changes would be lost.Proceed anyway?") = vbYes Then
adoRes.CancelUpdate
Else
adoRes.Update
End If
End If
MsgBox "Now exiting from application", vbInformation
Set adoRes = Nothing
Set adoConn = Nothing
frmResAdd.Visible = False
frmMain.Show
End Sub
Private Sub Timer1_Timer()
txtRDate.Text = Date
End Sub
Public Function Validate() As Boolean
Dim ret As Boolean
ret = True
errmsg = "Following errors are encountered in your data" + Chr(13) + Chr(13)
If Len(Trim(txtRDate.Text)) = 0 Then
errmsg = errmsg + "* Date cannot be left Blank" + Chr(13)
ret = False
End If
If Len(Trim(txtRName.Text)) = 0 Then
errmsg = errmsg + "* Name cannot be left blank " + Chr(13)
ret = False
End If
If Len(Trim(txtRAddress.Text)) = 0 Then
errmsg = errmsg + "* Address cannot be left blank " + Chr(13)
ret = False
End If
If Len(Trim(txtRPhone.Text)) = 0 Then
errmsg = errmsg + "* Phone number cannot be left blank " + Chr(13)
ret = False
End If
If Len(Trim(txtREstArrival.Text)) = 0 Then
errmsg = errmsg + "* Estimated Arrival Date cannot be left blank " + Chr(13)
ret = False
End If
Validate = ret
End Function
Private Sub cmdRSave_Click()
If Validate() = True Then
adoRes.Update
adoRes.MoveLast
adoRes.AddNew
Clearcontrols
Else
MsgBox errmsg, vbCritical, "Data entry Errors!!!"
End If
End Sub
Private Sub Form_Load()
Set adoConn = New ADODB.Connection
adoConn.ConnectionString = "Provider=MSDAORA;user id=scott;password=tiger;"
adoConn.CursorLocation = adUseClient
adoConn.Open
Set adoRes = New ADODB.Recordset
adoRes.CursorType = adOpenDynamic
adoRes.LockType = adLockOptimistic
adoRes.Open "Reservations", adoConn, , , adCmdTable
Set txtRDate.DataSource = adoRes
txtRDate.DataField = "Res_Date"
Set txtRName.DataSource = adoRes
txtRName.DataField = "Name"
Set txtRAddress.DataSource = adoRes
txtRAddress.DataField = "Address"
Set txtRPhone.DataSource = adoRes
txtRPhone.DataField = "Phone"
Set txtREstArrival.DataSource = adoRes
txtREstArrival.DataField = "Est_Arrival"
Set txtrAge.DataSource = adoRes
txtrAge.DataField = "Age"
Set txtRPincode.DataSource = adoRes
txtRPincode.DataField = "Pincode"
Set txtRCity.DataSource = adoRes
txtRCity.DataField = "City"
Set comRSex.DataSource = adoRes
comRSex.DataField = "Sex"
Set comRRoomType.DataSource = adoRes
comRRoomType.DataField = "Room_type"
adoRes.AddNew
End Sub
Private Sub Clearcontrols()
txtRDate.Text = ""
txtRName.Text = ""
txtRPhone.Text = ""
txtRAddress.Text = ""
txtREstArrival.Text = ""
txtRPhone.Text = ""
txtRCity.Text = ""
txtRPincode.Text = ""
comRSex.Text = ""
comRRoomType.Text = ""
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -