📄 frmcheckinadd.frm
字号:
Y2 = 9480
End
Begin VB.Label Label15
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Room No"
ForeColor = &H00000000&
Height = 240
Left = 960
TabIndex = 32
Top = 5400
Width = 990
End
Begin VB.Label Label14
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Occupied "
ForeColor = &H00000000&
Height = 240
Left = 2160
TabIndex = 31
Top = 5400
Width = 1065
End
Begin VB.Image Image2
Height = 240
Left = 14880
Picture = "frmCheckInAdd.frx":0691
Top = 120
Width = 270
End
Begin VB.Image Image1
Height = 360
Left = -1440
Picture = "frmCheckInAdd.frx":0A53
Top = 0
Width = 17595
End
Begin VB.Label Label13
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Enter the Visitor's ID"
ForeColor = &H00000000&
Height = 240
Left = 600
TabIndex = 27
Top = 2040
Width = 2115
End
Begin VB.Line Line8
BorderColor = &H00400000&
BorderWidth = 2
X1 = 360
X2 = 3840
Y1 = 4560
Y2 = 4560
End
Begin VB.Line Line7
BorderColor = &H00400000&
BorderWidth = 2
X1 = 3840
X2 = 3840
Y1 = 1440
Y2 = 4560
End
Begin VB.Line Line6
BorderColor = &H00400000&
BorderWidth = 2
X1 = 360
X2 = 3840
Y1 = 1440
Y2 = 1440
End
Begin VB.Line Line5
BorderColor = &H00400000&
BorderWidth = 2
X1 = 360
X2 = 360
Y1 = 1440
Y2 = 4560
End
Begin VB.Label Label10
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Room Number"
ForeColor = &H00000000&
Height = 240
Left = 4440
TabIndex = 24
Top = 9120
Width = 1500
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Room Type"
ForeColor = &H00000000&
Height = 240
Left = 4440
TabIndex = 23
Top = 8400
Width = 1230
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "Name"
ForeColor = &H00000000&
Height = 435
Left = 4440
TabIndex = 21
Top = 2520
Width = 855
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "Age"
ForeColor = &H00000000&
Height = 435
Left = 4440
TabIndex = 20
Top = 3240
Width = 825
End
Begin VB.Label Label4
Appearance = 0 'Flat
BackColor = &H80000005&
BackStyle = 0 'Transparent
Caption = "Sex"
ForeColor = &H00000000&
Height = 240
Left = 4440
TabIndex = 19
Top = 7680
Width = 405
End
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "Address"
ForeColor = &H00000000&
Height = 435
Left = 4440
TabIndex = 18
Top = 3960
Width = 1410
End
Begin VB.Label Label6
BackStyle = 0 'Transparent
Caption = "Date of arrival"
ForeColor = &H00000000&
Height = 315
Left = 4440
TabIndex = 17
Top = 1800
Width = 1695
End
Begin VB.Label Label7
BackStyle = 0 'Transparent
Caption = "Arrival Time"
ForeColor = &H00000000&
Height = 240
Left = 4440
TabIndex = 16
Top = 6840
Width = 1275
End
Begin VB.Label Label8
BackStyle = 0 'Transparent
Caption = "Phone"
ForeColor = &H00000000&
Height = 240
Left = 4440
TabIndex = 15
Top = 6120
Width = 675
End
Begin VB.Label Label9
BackStyle = 0 'Transparent
Caption = "City"
ForeColor = &H00000000&
Height = 315
Left = 4440
TabIndex = 14
Top = 4680
Width = 690
End
Begin VB.Label Label11
BackStyle = 0 'Transparent
Caption = "Pincode"
ForeColor = &H00000000&
Height = 240
Left = 4440
TabIndex = 13
Top = 5400
Width = 870
End
End
Attribute VB_Name = "frmCheckInAdd"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim adoConn As ADODB.Connection
Dim adoChIn As ADODB.Recordset
Dim errmsg As String
Private Sub Timer2_Timer()
MarqueeText1.ForeColor = vbYellow
End Sub
Private Sub Timer3_Timer()
MarqueeText1.ForeColor = vbRed
End Sub
Private Sub cmdInClose_Click()
If adoChIn.EditMode = adEditInProgress Then
If MsgBox("All unsaved changes would be lost.Proceed anyway?") = vbYes Then
adoChIn.CancelUpdate
Else
adoChIn.Update
End If
End If
MsgBox "Now exiting from application", vbInformation
Set adoChIn = Nothing
Set adoConn = Nothing
frmMain.Visible = True
frmCheckInAdd.Visible = False
End Sub
Public Function ValidateChIn() As Boolean
Dim ret As Boolean
ret = True
errmsg = "Following errors are encountered in your data" + Chr(13) + Chr(13)
If Len(Trim(txtInName.Text)) = 0 Then
errmsg = errmsg + "* Name cannot be left blank " + Chr(13)
ret = False
End If
If Len(Trim(txtInAddress.Text)) = 0 Then
errmsg = errmsg + "* Address cannot be left blank " + Chr(13)
ret = False
End If
If Len(Trim(txtInPhone.Text)) = 0 Then
errmsg = errmsg + "* Phone cannot be left blank " + Chr(13)
ret = False
End If
If Len(Trim(txtInPincode.Text)) = 0 Then
errmsg = errmsg + "* Pincode cannot be left blank " + Chr(13)
ret = False
End If
If Len(Trim(txtInCity.Text)) = 0 Then
errmsg = errmsg + "* City cannot be left blank " + Chr(13)
ret = False
End If
If Len(Trim(txtArrivalTime.Text)) = 0 Then
errmsg = errmsg + "* Arrival Time cannot be left blank " + Chr(13)
ret = False
End If
ValidateChIn = ret
End Function
Public Sub ClearcontrolsIn()
txtInName.Text = ""
txtInPhone.Text = ""
txtInAddress.Text = ""
txtInCity.Text = ""
txtInPincode.Text = ""
txtInAge.Text = ""
txtArrivalTime.Text = ""
txtInDateArrival.Text = ""
comInSex.Text = ""
comResRoom = ""
txtRoomNo.Text = ""
End Sub
Private Sub cmdInSave_Click()
If ValidateChIn() = True Then
adoChIn.Update
adoChIn.MoveLast
adoChIn.AddNew
lstOccupied.AddItem txtRoomNo.Text
ClearcontrolsIn
Else
MsgBox errmsg, vbCritical, "Data entry Errors!!!"
End If
End Sub
Private Sub cmdSearch_Click()
Dim intVstNo As Single
Dim strCriteria As String
Dim varMark As Variant
Dim Found As Boolean
Found = False
If txtInSearch.Text <> "" Then
intVstNo = Val(txtInSearch)
strCriteria = "Visitor_No =" & intVstNo
adoCheckIn.Recordset.Find strCriteria, 0, adSearchForward, adBookmarkCurrent
Do While Not adoCheckIn.Recordset.EOF
txtInName.Text = adoCheckIn.Recordset.Fields("Name").Value
txtInAddress.Text = adoCheckIn.Recordset.Fields("Address").Value
txtInPhone.Text = adoCheckIn.Recordset.Fields("Phone").Value
txtInDateArrival.Text = adoCheckIn.Recordset.Fields("DATE_OF_ARRIVAL").Value
txtInAge.Text = adoCheckIn.Recordset.Fields("Age").Value
txtInPincode.Text = adoCheckIn.Recordset.Fields("Pincode").Value
txtInCity.Text = adoCheckIn.Recordset.Fields("City").Value
varMark = adoCheckIn.Recordset.Bookmark
Found = True
adoCheckIn.Recordset.Find strCriteria, 1, adSearchForward, varMark
Loop
Else
MsgBox "This Visitor's ID does not exist", vbCritical, "Wrong Entry"
End If
End Sub
Private Sub Image2_Click()
If adoChIn.EditMode = adEditInProgress Then
If MsgBox("All unsaved changes would be lost.Proceed anyway?") = vbYes Then
adoChIn.CancelUpdate
Else
adoChIn.Update
End If
End If
MsgBox "Now exiting from application", vbInformation
Set adoChIn = Nothing
Set adoConn = Nothing
frmMain.Visible = True
frmCheckInAdd.Visible = False
End Sub
Private Sub Timer1_Timer()
txtArrivalTime.Text = Time()
txtInDateArrival.Text = Date
End Sub
Private Sub Form_Load()
MsgBox "Connecting Oracle.Please wait...", vbInformation, "Wait"
Set adoConn = New ADODB.Connection
adoConn.ConnectionString = "Provider=MSDAORA;user id=scott;password=tiger;"
adoConn.CursorLocation = adUseClient
adoConn.Open
Set adoChIn = New ADODB.Recordset
adoChIn.CursorType = adOpenDynamic
adoChIn.LockType = adLockOptimistic
adoChIn.Open "Check_In", adoConn, , , adCmdTable
Set txtVstNumber.DataSource = adoChIn
txtVstNumber.DataField = "Visitor_no"
Set txtInName.DataSource = adoChIn
txtInName.DataField = "Name"
Set txtInAddress.DataSource = adoChIn
txtInAddress.DataField = "Address"
Set txtInPhone.DataSource = adoChIn
txtInPhone.DataField = "Phone"
Set txtInPincode.DataSource = adoChIn
txtInPincode.DataField = "Pincode"
Set txtInCity.DataSource = adoChIn
txtInCity.DataField = "City"
Set txtInDateArrival.DataSource = adoChIn
txtInDateArrival.DataField = "Date_of_Arrival"
Set txtArrivalTime.DataSource = adoChIn
txtArrivalTime.DataField = "Arrival_Time"
Set txtInAge.DataSource = adoChIn
txtInAge.DataField = "Age"
Set comInSex.DataSource = adoChIn
comInSex.DataField = "Sex"
Set txtRoomNo.DataSource = adoChIn
txtRoomNo.DataField = "Room_no"
adoChIn.AddNew
Adodc1.Refresh
lstOccupied.Clear
Do While Adodc1.Recordset.EOF = False
lstOccupied.AddItem Adodc1.Recordset.Fields("Room_No")
Adodc1.Recordset.MoveNext
Loop
Timer2.Enabled = True
Timer3.Enabled = True
End Sub
Private Sub txtInName_KeyPress(KeyAscii As Integer)
Call ConvUpcase(KeyAscii)
End Sub
Private Sub txtInAddress_KeyPress(KeyAscii As Integer)
Call ConvUpcase(KeyAscii)
End Sub
Private Sub txtInPhone_KeyPress(KeyAscii As Integer)
Call ConvUpcase(KeyAscii)
End Sub
Private Sub txtInPincode_KeyPress(KeyAscii As Integer)
Call ConvUpcase(KeyAscii)
End Sub
Private Sub txtInCity_KeyPress(KeyAscii As Integer)
Call ConvUpcase(KeyAscii)
End Sub
Private Sub txtInDateArrival_KeyPress(KeyAscii As Integer)
Call ConvUpcase(KeyAscii)
End Sub
Private Sub txtArrivalTime_KeyPress(KeyAscii As Integer)
Call ConvUpcase(KeyAscii)
End Sub
Private Sub txtInAge_KeyPress(KeyAscii As Integer)
Call ConvUpcase(KeyAscii)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -