Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 48

Hotel Booikng System

Main Window Form

Private Sub cancel_Click()


cancel.Show
End Sub

Private Sub cancellation_Click()


cancel.Show
End Sub

Private Sub digitalclk_Click()


clock.Show
End Sub

Private Sub Image1_Click()


Load login
login.Show
End Sub

Private Sub Image2_Click()


roomentry.Show

End Sub

Private Sub Image3_Click()


Load customer
customer.Show
End Sub

Private Sub Image4_Click()


Load Bill
Bill.Show
End Sub

Private Sub Image5_Click()


cancel.Show
End Sub

Private Sub Image6_Click()


a = MsgBox("Are You Sure Want To Log Off", vbYesNo, "Log Off Application")
If a = 6 Then
nmmaster.Enabled = False
mnDetails.Enabled = False
mnLoginWindow.Enabled = True
mnlogoff.Enabled = False
MDIForm1.Image1.Enabled = True
MDIForm1.Image2.Enabled = False
MDIForm1.Image3.Enabled = False
MDIForm1.Image4.Enabled = False
MDIForm1.Image5.Enabled = False
MDIForm1.Image6.Enabled = False
End If
End Sub

Private Sub Image7_Click()


hinfo.Show

End Sub

Private Sub MDIForm_Load()


nmmaster.Enabled = False
mnDetails.Enabled = False
mnlogoff.Enabled = False
End Sub

Private Sub MDIForm_Resize()


'Me.Label2.Left = Me.Label2.Left - 5
'If Label2.Left = Me.Width - 50 Then
'Label2.Left = Me.Width - 50
'End If
End Sub

Private Sub mnaboutme_Click()


Load about
about.Show 1
End Sub

Private Sub mnavailability_Click()


Load Availability
Availability.Show
End Sub

Private Sub mnBill_Click()


Load Bill
Bill.Show
End Sub

Private Sub mnBooking_Click()


Load Booking
Booking.Show
End Sub

Private Sub mnCalculator_Click()


On Error GoTo Err
Shell "calc.exe", vbNormalFocus
Exit Sub
Err:
MsgBox "You don't have a Calculator installed in your computer.",
vbExclamation, "CSRS version 1"
End Sub

Private Sub mnCity_Hotel_Room_Click()


Load CityHotelRoom
CityHotelRoom.Show
End Sub
Private Sub mncityhotel_Click()
Load CITYHOTEL
CITYHOTEL.Show
End Sub

Private Sub mncustomer_Click()


Load customer
customer.Show
End Sub

Private Sub mnexit_Click()


End
End Sub

Private Sub mnHotelInformation_Click()


hinfo.Show
End Sub

Private Sub mnLoginWindow_Click()


Load login
login.Show
End Sub

Private Sub mnOfflinePayment_Click()


Load OfflinePayment
OfflinePayment.Show
End Sub

Private Sub mnOnlinePayment_Click()


Load OnlinePayment
OnlinePayment.Show
End Sub

Private Sub mnPayment_Click()


Load Payment
Payment.Show
End Sub

Private Sub mnlogoff_Click()


a = MsgBox("Are You Sure Want To Log Off", vbYesNo, "Log Off Application")
If a = 6 Then
nmmaster.Enabled = False
mnDetails.Enabled = False
mnLoginWindow.Enabled = True
mnlogoff.Enabled = False
End If
End Sub

Private Sub mnroomentry_Click()


roomentry.Show
End Sub

Private Sub mnrooms_Click()


total_room.Show
End Sub

Private Sub Timer1_Timer()


Label1.ForeColor = Rnd(100) * RGB(100, 100, 100)
End Sub

Private Sub Timer2_Timer()


Label1.Left = Label1.Left + 100
If Label1.Left > MDIForm1.Width Then Label1.Left = 0 ' - Label1.Left
End Sub

Private Sub Timer3_Timer()


Me.Label2.Caption = Time
Me.Label2.ToolTipText = Format(Date, "dddd,MMMM,dd,yyyy")
End Sub
Login Window Form

Dim rec As New ADODB.Recordset

Private Sub Command1_Click()


If Text3.Text = Text1.Text And Text4.Text = Text2.Text Then
Load MDIForm1
MDIForm1.Show
MDIForm1.nmmaster.Enabled = True
MDIForm1.mnDetails.Enabled = True
MDIForm1.mnLoginWindow.Enabled = False
MDIForm1.mnlogoff.Enabled = True
MDIForm1.Image1.Enabled = False
MDIForm1.Image2.Enabled = True
MDIForm1.Image3.Enabled = True
MDIForm1.Image4.Enabled = True
MDIForm1.Image5.Enabled = True
MDIForm1.Image6.Enabled = True
Unload Me
Else
'MsgBox "User Name or Password Incorrect"
Label5.Caption = "Access Denied:Please Give Correct User Id And Password"
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
End If
End Sub

Private Sub Command2_Click()


End
End Sub

Private Sub Command3_Click()


Form2.Show
Unload Me
End Sub

Private Sub Form_Load()


Call connect
Set rec = New ADODB.Recordset
rec.Open "select * from secu", conn, 2, 3
Text3.Text = rec(0)
Text4.Text = rec(1)
Text5.Text = rec(2)
Label5.Caption = "Please Give User Name And Password"

End Sub

Private Sub Image2_Click()


End
End Sub

Private Sub Image3_Click()


login.WindowState = 1
End Sub

Private Sub Image4_Click()


'Image4.ToolTipText = Text5.Text
End Sub

Private Sub Image4_MouseMove(Button As Integer, Shift As Integer, X As Single,


Y As Single)
Image4.ToolTipText = Text5.Text
End Sub

Private Sub Text2_KeyPress(KeyAscii As Integer)


If KeyAscii = 13 Then
Command1.SetFocus
End If
End Sub
Private Sub Timer1_Timer()
Label3.Visible = True
Label4.Visible = False
P.Value = P.Value + 5
If P.Value > 9 Then
Label3.Visible = False
Label4.Visible = True
If P.Value = 10 Then
P.Value = 0
'Label3.Visible = True
'Label4.Visible = False
End If
End If
'Label3.ForeColor = Rnd(100) * RGB(100, 100, 100)
End Sub
Change Password Form

Dim rs As New ADODB.Recordset


Private Sub Command1_Click()
If login.Text3.Text = Form2.Text1.Text And login.Text4.Text =
Form2.Text2.Text Then
Call change
Else
MsgBox "Current User Nmae or Passowrd Wrong"
Form2.Text1 = ""
Form2.Text2 = ""
End If
End Sub

Private Sub Command2_Click()


Unload Me
Load login
login.Show
End Sub

Private Sub Form_Load()


Set rs = New ADODB.Recordset
rs.Open "select * from secu", conn, 2, 3
End Sub

Private Sub Timer1_Timer()


Label7.ForeColor = Rnd(100) * RGB(100, 100, 100)
End Sub
Private Sub change()
If Text4.Text = Text5.Text Then
rs(0) = Text3.Text
rs(1) = Text4.Text
rs(2) = Text6.Text
rs.Update
MsgBox "Change Password Successfully", vbOKOnly, "Change Password"
Load login
login.Show
login.Image4.ToolTipText = Form2.Text6
Unload Me

Else
MsgBox "New Password and Conform Password is not Same" & vbCrLf & "Please
Enter Both are same"
End If
End Sub
Room Entry Form

Dim db As ADODB.Connection
Dim rs As ADODB.Recordset

Private Sub Combo5_Click()


Call connect2
Set rs = New ADODB.Recordset
X = "select * FROM roomentry WHERE roomno='" & Val(Combo5.Text) & "'"
rs.Open X, con, 3, 3
Combo4.Text = rs(1)
Combo3.Text = rs(2)
Text2.Text = rs(3)
End Sub

Private Sub Combo6_Click()


Call connect2
Set rs = New ADODB.Recordset
X = "select * FROM roomentry WHERE roomno='" & Val(Combo6.Text) & "'"
rs.Open X, con, 3, 3
Combo7.Text = rs(1)
Combo8.Text = rs(2)
Text4.Text = rs(3)

End Sub

Private Sub Command1_Click()


Frame1.Enabled = True
Frame2.Enabled = True
Text1.SetFocus
Command5.Visible = True
Command1.Visible = False
End Sub

Private Sub Command10_Click()


Dim a As Integer
Dim b As String
a = Val(Combo6.Text)
b = "update roomentry set roomno='" & Combo6.Text & "',type='" _
& Combo7.Text & "',floor='" & Combo8.Text & "',rate='" & Text4.Text & _
"'where roomno='" & a & "'"
connect2
con.Execute b
MsgBox "Record is Updated", vbOKOnly, "Delete Room"
Frame5.Visible = False
Combo7.Text = ""
Combo8.Text = ""
Text4.Text = ""
Frame1.Visible = True
Frame4.Visible = True
End Sub

Private Sub Command2_Click()


If Text1.Text = "" Then
MsgBox "Please Enetr a Room Number"
Else
Call connect2
Set rs = New ADODB.Recordset
X = "select count (roomno) FROM roomentry WHERE roomno='" & Text1.Text &
"'"
rs.Open X, con, 3, 3
'MsgBox rs(0)
If (rs(0) = 1) Then
MsgBox " This Room No Already Exist"
Text1.Text = ""
rs.MoveNext
Else
If Text1.Text = "" Then
MsgBox "Please Enter Room No"
Exit Sub
ElseIf Combo1.Text = "" Then
MsgBox "Please Enter Room Type"
Exit Sub
ElseIf Combo2.Text = "" Then
MsgBox "Please Enter Floor"
Exit Sub
ElseIf Text3.Text = "" Then
MsgBox "Please Enter Room Rate"
Exit Sub
Else
Call connect2
Set db = New ADODB.Connection
db.Open con
db.Execute "insert into roomentry values(" & Text1.Text & ",'" &
UCase(Combo1.Text) _
& "','" & UCase(Combo2.Text) & "','" & (Text3.Text) & "','" & "Available" & "')"
MsgBox "Record is Saved"
End If
End If
Text1.Text = ""
Text3.Text = ""
Combo1.Text = Combo1.List(0)
Combo2.Text = Combo2.List(0)
Frame1.Enabled = False
Frame2.Enabled = False
Command1.Visible = True
Command5.Visible = False
End If
End Sub

Private Sub Command3_Click()


Frame3.Visible = True
Call connect2
Combo5.Clear
Set rs = New ADODB.Recordset
b = "select roomno from roomentry"
rs.Open b, con, 2, 3
Do Until rs.EOF
Combo5.AddItem rs(0)
rs.MoveNext
Loop
Frame1.Visible = False
Frame4.Visible = False
End Sub

Private Sub Command4_Click()


Unload Me
End Sub

Private Sub Command5_Click()


Frame1.Enabled = False
Command5.Visible = False
Command1.Visible = True
Me.Text1.Text = ""
Me.Text3.Text = ""
End Sub

Private Sub Command6_Click()


Dim a As Integer
a = Val(Combo5.Text)
connect2
con.Execute "delete * from roomentry where roomno='" & a & "'"
MsgBox "Record is deleted", vbOKOnly, "Delete Room"
Frame3.Visible = False
Combo3.Text = ""
Combo4.Text = ""
Text2.Text = ""
Frame1.Visible = True
Frame4.Visible = True
End Sub
Private Sub Command7_Click()
Frame1.Visible = True
Frame3.Visible = False
Frame4.Visible = True
End Sub

Private Sub Command8_Click()


Frame5.Visible = True
Call connect2
Combo6.Clear
Set rs = New ADODB.Recordset
b = "select roomno from roomentry"
rs.Open b, con, 2, 3
Do Until rs.EOF
Combo6.AddItem rs(0)
rs.MoveNext
Loop
Frame1.Visible = False
Frame4.Visible = False
End Sub

Private Sub Command9_Click()


Frame1.Visible = True
Frame5.Visible = False
Frame4.Visible = True
End Sub

Private Sub Form_Load()


Combo1.Text = Combo1.List(0)
Combo2.Text = Combo2.List(0)
End Sub

Private Sub Text1_Change()


If Text1.Text <> LCase(Text1.Text) Or Text1.Text <> UCase(Text1.Text) Then
MsgBox "Please Enter the Number Only"
End If
End Sub

Private Sub Text3_LostFocus()


Text3.Text = Format(Text3.Text, "#,###.00")
End Sub
Customer Booking Form

Dim rs As ADODB.Recordset
Dim db As ADODB.Connection

Private Sub Combo1_Click()


Set rs = New ADODB.Recordset
b = "select * from roomentry where roomno='" & Val(Combo1.Text) & "'"
rs.Open b, con, 2, 3
Text2.Text = rs(2)
Text3.Text = rs(3)
End Sub

Private Sub Combo2_Click()


Dim b As String
Combo1.Clear
Call connect2
Set rs = New ADODB.Recordset
b = "select roomno from roomentry where type='" + Combo2.Text + "' and
status='" + "Available" + "'"
rs.Open b, con, 2, 3
Do Until rs.EOF
Combo1.AddItem rs(0)
rs.MoveNext
Loop
End Sub

Private Sub Command1_Click()


Call connect2
Set rs = New ADODB.Recordset
X = "select count (bid) FROM custbook WHERE bid='" & Text1.Text & "'"
rs.Open X, con, 3, 3
'MsgBox rs(0)
If (rs(0) = 1) Then
MsgBox " This Booking Id Already Exist"
'Text1.Text = ""
rs.MoveNext
Exit Sub
End If
Dim b As String
Call connect2
Set db = New ADODB.Connection
db.Open con
b = "insert into custbook values('" & Text1.Text & "','" & Format(dat.Value,
"dd/MM/yyyy") _
& "','" & UCase(Combo2.Text) & "','" & Combo1.Text & "','" & Text2.Text & _
"','" & Text3.Text & "','" & Text4.Text & "','" & Text5.Text & "','" _
& Text6.Text & "')"
If Combo2.Text = "" Then
MsgBox "Please Enter the Room Type"
Exit Sub
ElseIf Combo1.Text = "" Then
MsgBox "Please Enter the Room Number"
Exit Sub
ElseIf Text4.Text = "" Then
MsgBox "Please Enter the Customer Name"
Exit Sub
ElseIf Text5.Text = "" Then
MsgBox "Please Enter the Address"
Exit Sub
ElseIf Text6.Text = "" Then
MsgBox "Please Enter the Phone Number"
Exit Sub
End If
db.Execute b
b = "update roomentry set status='" & "Booked" & "' where roomno='" &
Combo1.Text & "'"
db.Execute b
MsgBox "Record is Saved"
Me.dat.Value = Format(Date, "dd/MM/yyyy")
Me.Combo2.Text = ""
Me.Combo1.Text = ""
Me.Text2.Text = ""
Me.Text3.Text = ""
Me.Text4.Text = ""
Me.Text5.Text = ""
Me.Text6.Text = ""
autono
End Sub

Sub autono()
On Error GoTo errt
Dim b, d As Integer
Dim c As String
Call connect2
Set rs = New ADODB.Recordset
c = "select bid from custbook"
rs.Open c, con, 2, 3
If rs.RecordCount > -2 Then
rs.MoveLast
b = rs(0) + 1
Else
b=1
End If
Text1.Text = b
Exit Sub
errt:
b=1
Text1.Text = b
End Sub

Private Sub Command2_Click()


Command1.Visible = True
Command4.Visible = True
Command2.Visible = False
Me.Text1.Text = ""
Me.dat.Value = Format(Date, "dd/MM/yyyy")
Me.Combo2.Text = ""
Me.Combo1.Text = ""
Me.Text2.Text = ""
Me.Text3.Text = ""
Me.Text4.Text = ""
Me.Text5.Text = ""
Me.Text6.Text = ""
autono
End Sub

Private Sub Command3_Click()


Command1.Visible = False
Command2.Visible = True
Command4.Visible = False
On Error GoTo errt
Dim a As Integer
Dim b As String
a = Val(InputBox("Enter the Booking Id"))
b = "select * from custbook where bid='" & a & "'"
connect2
rs.Close
rs.Open b, con, 2, 3
'If rs.RecordCount > 0 Then
Me.Text1.Text = rs(0)
Me.dat.Value = rs(1)
Me.Combo2.Text = rs(2)
Me.Combo1.Text = rs(3)
Me.Text2.Text = rs(4)
Me.Text3.Text = rs(5)
Me.Text4.Text = rs(6)
Me.Text5.Text = rs(7)
Me.Text6.Text = rs(8)
Exit Sub
errt:
MsgBox "Record not Found"
'End If
End Sub

Private Sub Command4_Click()


Unload Me
End Sub

Private Sub Form_Load()


Command2.Visible = False
autono
dat.Value = Format(Date, "dd/MM/yyyy")
End Sub

Private Sub Text6_Change()


If Text6.Text <> LCase(Text6.Text) Or Text6.Text <> UCase(Text6.Text) Then
MsgBox "Please Enter The Number only"
Text6.Text = ""
End If
End Sub
Billing Form

Dim rs2 As New ADODB.Recordset


Dim rs As New ADODB.Recordset

Private Sub Combo1_Click()


Dim b As String
connect2
b = "select * from custbook where bid='" & Combo1.Text & "'"
Set rs = New ADODB.Recordset
rs.Open b, con, 2, 3
Text1.Text = rs(6)
Text2.Text = rs(7)
Text3.Text = rs(3)
Text4.Text = rs(5)
Text5.Text = rs(1)
autono
Text7.Text = Format(Date, "dd/mm/yyyy")
Text8.Text = Val(Text7.Text) - Val(Text5.Text)
If Text8.Text = 0 Then Text8.Text = 1
Text9.Text = Val(Text4.Text) * Val(Text8.Text)
End Sub

Private Sub Command1_Click()

End Sub

Private Sub Command6_Click()


If Combo1.Text = "" Then
MsgBox "Please Select the Booking Id"
Exit Sub
End If
Dim b As String
Set rs2 = New ADODB.Recordset
X = "select count (bno) FROM billing WHERE bno='" & Combo1.Text & "'"
rs2.Open X, con, 3, 3
If (rs2(0) = 1) Then
MsgBox " This Booking no's Bill has been Already Printed"
Exit Sub
End If
b = "insert into billing values('" & Combo1.Text & "','" & Text1.Text & _
"','" & Text2.Text & "','" & Text3.Text & "','" & Text4.Text & "','" & Text5.Text &
_
"','" & Text6.Text & "','" & Text7.Text & "','" & Text8.Text & "','" & Text9.Text &
"')"
connect2
con.Execute b
b = "update roomentry set status='" & "Available" & "' where roomno='" &
Text3.Text & "'"
con.Execute b
b = "delete * from billingtemp"
con.Execute b
b = "insert into billingtemp values('" & Combo1.Text & "','" & Text1.Text & _
"','" & Text2.Text & "','" & Text3.Text & "','" & Text4.Text & "','" & Text5.Text &
_
"','" & Text6.Text & "','" & Text7.Text & "','" & Text8.Text & "','" & Text9.Text &
"')"
connect2
con.Execute b
MsgBox "Record is Saved and now doing for print peview"
DataReport1.Show
Unload DataEnvironment1
End Sub

Private Sub Command7_Click()


Unload Me
End Sub

Private Sub Form_Load()


Dim b As String
Combo1.Clear
Call connect2
Set rs = New ADODB.Recordset
b = "select bid from custbook"
rs.Open b, con, 2, 3
Do Until rs.EOF

Combo1.AddItem rs(0)
rs.MoveNext
Loop
End Sub
Sub autono()
On Error GoTo errt
Dim b, d As Integer
Dim c As String
Call connect2
Set rs = New ADODB.Recordset
c = "select bino from billing"
rs.Open c, con, 2, 3
If rs.RecordCount > -2 Then
rs.MoveLast
b = rs(0) + 1
Else
b=1
End If
Text6.Text = b
Exit Sub
errt:
b=1
Text6.Text = b
End Sub
Cancellation Form

Dim rs2 As New ADODB.Recordset


Dim rs As New ADODB.Recordset

Private Sub Combo1_Click()


Dim b As String
connect2
b = "select * from custbook where bid='" & Combo1.Text & "'"
Set rs = New ADODB.Recordset
rs.Open b, con, 2, 3
Text1.Text = rs(6)
Text2.Text = rs(7)
Text3.Text = rs(3)
Text4.Text = rs(5)
Text5.Text = rs(1)
autono
Text7.Text = Format(Date, "dd/mm/yyyy")
End Sub

Private Sub Command1_Click()

End Sub

Private Sub Command6_Click()


If Combo1.Text = "" Then
MsgBox "Please Select the Booking Id"
Exit Sub
End If
If Text8.Text = "" Then
MsgBox "Please enter the Cancelation Percent"
Exit Sub
End If
Dim b As String
Set rs2 = New ADODB.Recordset
X = "select count (bno) FROM cancel WHERE bno='" & Combo1.Text & "'"
rs2.Open X, con, 3, 3
If (rs2(0) = 1) Then
MsgBox " This Booking no's Bill has been Already Canceled"
Exit Sub
End If
connect2
b = "insert into cancel values('" & Combo1.Text & "','" & Text1.Text & _
"','" & Text2.Text & "','" & Text3.Text & "','" & Text4.Text & "','" & Text5.Text &
_
"','" & Text6.Text & "','" & Text7.Text & "','" & Text8.Text & "','" & Text9.Text &
"')"
con.Execute b
b = "delete * from canceltemp"
con.Execute b
b = "insert into canceltemp values('" & Combo1.Text & "','" & Text1.Text & _
"','" & Text2.Text & "','" & Text3.Text & "','" & Text4.Text & "','" & Text5.Text &
_
"','" & Text6.Text & "','" & Text7.Text & "','" & Text8.Text & "','" & Text9.Text &
"')"
con.Execute b
b = "update roomentry set status='" & "Available" & "' where roomno='" &
Text3.Text & "'"
con.Execute b
MsgBox "Record is Saved and now doing for print peview"
DataReport2.Show
Unload DataEnvironment1
Unload Me
End Sub

Private Sub Command7_Click()


Unload Me
End Sub

Private Sub Form_Load()


Dim b As String
Combo1.Clear
Call connect2
Set rs = New ADODB.Recordset
b = "select bid from custbook"
rs.Open b, con, 2, 3
Do Until rs.EOF
Combo1.AddItem rs(0)
rs.MoveNext
Loop
End Sub

Sub autono()
On Error GoTo errt
Dim b, d As Integer
Dim c As String
Call connect2
Set rs = New ADODB.Recordset
c = "select bino from billing"
rs.Open c, con, 2, 3
If rs.RecordCount > -2 Then
rs.MoveLast
b = rs(0) + 1
Else
b=1
End If
Text6.Text = b
Exit Sub
errt:
b=1
Text6.Text = b
End Sub

Private Sub Text8_Change()


On Error GoTo rr
'If Text8.Text = "" Then Text8.Text = 1
Text9.Text = Val(Val(Text4.Text) - Val(Text4.Text * Text8.Text / 100))
rr:
End Sub

Total Availability Form

Dim H As New ADODB.Recordset


Private Sub Command1_Click()
Dim Itmx As ListItem
connect2
H.Open "select * from roomentry where status='" & "Available" & "'", con, 2, 3
I=1
ListView1.ListItems.Clear
Do While H.EOF <> True
Set Itmx = Me.ListView1.ListItems.Add(, , H(0))
Itmx.SubItems(1) = H(1)
Itmx.SubItems(2) = H(2)
Itmx.SubItems(3) = H(3)
I=I+1
H.MoveNext
Loop
H.Close
End Sub

Private Sub Command2_Click()


Unload Me
End Sub

Private Sub Form_Load()


Me.ListView1.ColumnHeaders.Add , , "Room No.", 1850
Me.ListView1.ColumnHeaders.Add , , "Type", 2500
Me.ListView1.ColumnHeaders.Add , , "Floor", 2500
Me.ListView1.ColumnHeaders.Add , , "Rate", 3000
End Sub
Total Booking From

Dim H As New ADODB.Recordset


Private Sub Command1_Click()
Dim Itmx As ListItem
connect2
H.Open "select * from roomentry where status='" & "Booked" & "'", con, 2, 3
I=1
ListView1.ListItems.Clear
Do While H.EOF <> True
Set Itmx = Me.ListView1.ListItems.Add(, , H(0))
Itmx.SubItems(1) = H(1)
Itmx.SubItems(2) = H(2)
Itmx.SubItems(3) = H(3)
I=I+1
H.MoveNext
Loop
H.Close
End Sub

Private Sub Command2_Click()


Unload Me
End Sub

Private Sub Form_Load()


Me.ListView1.ColumnHeaders.Add , , "Room No.", 1850
Me.ListView1.ColumnHeaders.Add , , "Type", 2500
Me.ListView1.ColumnHeaders.Add , , "Floor", 2500
Me.ListView1.ColumnHeaders.Add , , "Rate", 3000
End Sub
Total Room From

Dim H As New ADODB.Recordset


Dim db As ADODB.Connection

Private Sub Combo1_Click()


Dim H As New ADODB.Recordset
Dim Itmx As ListItem
connect2
H.Open "select * from roomentry where type='" & Combo1.Text & "'", con, 2, 3
I=1
ListView1.ListItems.Clear
Do While H.EOF <> True
Set Itmx = Me.ListView1.ListItems.Add(, , H(0))
Itmx.SubItems(1) = H(1)
Itmx.SubItems(2) = H(2)
Itmx.SubItems(3) = H(3)
Itmx.SubItems(4) = H(4)
I=I+1
H.MoveNext
Loop
H.Close
End Sub

Private Sub Command2_Click()


Unload Me
End Sub

Private Sub Form_Load()


Me.ListView1.ColumnHeaders.Add , , "Room No.", 1900
Me.ListView1.ColumnHeaders.Add , , "Type", 2000
Me.ListView1.ColumnHeaders.Add , , "Floor", 2000
Me.ListView1.ColumnHeaders.Add , , "Rate", 2000
Me.ListView1.ColumnHeaders.Add , , "Status", 2000

End Sub
Hotel Information Form

Dim db As ADODB.Connection
Dim rs As ADODB.Recordset
Dim rs2 As ADODB.Recordset

Private Sub Command1_Click()


If Text1.Text = "" Then
MsgBox "Please Fullfil Information"
Exit Sub
ElseIf Text2.Text = "" Then
MsgBox "Please Fullfil Information"
Exit Sub
ElseIf Text3.Text = "" Then
MsgBox "Please Fullfil Information"
Exit Sub
ElseIf Text4.Text = "" Then
MsgBox "Please Fullfil Information"
Exit Sub
ElseIf Text5.Text = "" Then
MsgBox "Please Fullfil Information"
Exit Sub
End If
connect2
Set db = New ADODB.Connection
db.Open con
db.Execute "delete * from hinfo"
db.Execute "insert into hinfo values('" & UCase(Text1.Text) & "','" &
UCase(Text2.Text) _
& "','" & UCase(Text3.Text) & "','" & UCase(Text4.Text) & "','" &
UCase(Text5.Text) & "')"
MsgBox "Record is Saved"
connect2
Set rs = New ADODB.Recordset
rs.Open "select * from hinfo", con, 2, 3
Text1.Text = rs(0)
Text2.Text = rs(1)
Text3.Text = rs(2)
Text4.Text = rs(3)
Text5.Text = rs(4)
Command3.Visible = True
Command1.Visible = False
End Sub

Private Sub Command2_Click()


Unload Me
End Sub
Private Sub Command3_Click()
Dim b As String
b = InputBox("Enter The Passwowrd", "Update Hotel Information")
If Text6.Text = b Then
Text1.Locked = False
Text2.Locked = False
Text3.Locked = False
Text4.Locked = False
Text5.Locked = False
MsgBox "Alow for updating"
Text1.SetFocus
Command3.Visible = False
Command1.Visible = True
Else
MsgBox "Please Enter Currect Password"
End If
End Sub

Private Sub Form_Load()


connect2
Set rs = New ADODB.Recordset
rs.Open "select * from hinfo", con, 2, 3
Text1.Text = rs(0)
Text2.Text = rs(1)
Text3.Text = rs(2)
Text4.Text = rs(3)
Text5.Text = rs(4)
connect
Set rs2 = New ADODB.Recordset
rs2.Open "select * from secu", conn, 2, 3
Text6.Text = rs2(1)
End Sub

Digital Clock Form

Option Explicit
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long,
ByVal hwndinterafter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As
Long, ByVal cy As Long, ByVal wflage As Long) As Long
Const hwnd_topmost = -1
Const swp_showwindow = &H40

Private Sub Form_Load()


Dim retvalue As Long
retvalue = SetWindowPos(Me.hwnd, hwnd_topmost, Me.CurrentX, Me.CurrentY,
90, 27, swp_showwindow)
Me.KeepOnTop.Enabled = False
clock.Move 12900, 10, 1500, 400
Me.righttop.Enabled = False

End Sub

Private Sub KeepOnTop_Click()


Dim retvalue As Long
retvalue = SetWindowPos(Me.hwnd, hwnd_topmost, Me.CurrentX, Me.CurrentY,
90, 27, swp_showwindow)
KeepOnTop.Enabled = False
RemoveAlwaysTop.Enabled = True
If Me.righttop.Enabled = False Then
clock.Move 12900, 10, 1500, 400
ElseIf Me.rightbottom.Enabled = False Then
clock.Move 13900, 10650, 1500, 400
ElseIf Me.leftbottom.Enabled = False Then
clock.Move 10, 10650, 1500, 400
ElseIf Me.lefttop.Enabled = False Then
clock.Move 300, 10, 1500, 400
ElseIf Me.mnCenter.Enabled = False Then
clock.Move 7000, 5600, 1500, 400
End If
End Sub

Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single,


Y As Single)
Me.Label1.ToolTipText = Format(Date, " dddd, dd MMMM, yyyy")
End Sub

Private Sub Label1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y


As Single)
If Button = 2 Then
PopupMenu mnmenu
End If
End Sub

Private Sub leftbottom_Click()


clock.Move 10, 10650, 1500, 400
Me.righttop.Enabled = True
Me.rightbottom.Enabled = True
Me.mnCenter.Enabled = True
Me.leftbottom.Enabled = False
Me.lefttop.Enabled = True
End Sub

Private Sub lefttop_Click()


clock.Move 300, 10, 1500, 400
Me.righttop.Enabled = True
Me.rightbottom.Enabled = True
Me.mnCenter.Enabled = True
Me.leftbottom.Enabled = True
Me.lefttop.Enabled = False
End Sub

Private Sub mnabout_Click()


MsgBox "Copyright(c)2008-2009 Manish Vishwakarma BCA" & vbCrLf & "Contact
E_mail : manish20vns@yahoo.com", vbInformation, "About Clock"
End Sub

Private Sub mnbgcolor_Click()


On Error GoTo Errortrap
CommonDialog1.Action = 3 'Display color box
'Me.Label1.ForeColor = CommonDialog1.Color
Me.Label1.BackColor = CommonDialog1.Color
Exit Sub
Errortrap:
MsgBox " Dialog box is canceled "
End Sub

Private Sub mnCenter_Click()


clock.Move 7000, 5600, 1500, 400
Me.righttop.Enabled = True
Me.rightbottom.Enabled = True
Me.mnCenter.Enabled = False
Me.leftbottom.Enabled = True
Me.lefttop.Enabled = True
End Sub

Private Sub mnexit_Click()


Unload Me
End Sub

Private Sub mnfotn_Click()


On Error GoTo Errortrap
CommonDialog1.Action = 3 'Display color box
Me.Label1.ForeColor = CommonDialog1.Color
'Me.Label1.BackColor = CommonDialog1.Color
Exit Sub
Errortrap:
MsgBox " Dialog box is canceled "

End Sub

Private Sub RemoveAlwaysTop_Click()


KeepOnTop.Enabled = True
RemoveAlwaysTop.Enabled = False
Dim retvalue As Long
Const hwnd_topmost = 1
retvalue = SetWindowPos(Me.hwnd, hwnd_topmost, Me.CurrentX, Me.CurrentY,
90, 27, swp_showwindow)
If Me.righttop.Enabled = False Then
clock.Move 12900, 10, 1500, 400
ElseIf Me.rightbottom.Enabled = False Then
clock.Move 13900, 10650, 1500, 400
ElseIf Me.leftbottom.Enabled = False Then
clock.Move 10, 10650, 1500, 400
ElseIf Me.lefttop.Enabled = False Then
clock.Move 300, 10, 1500, 400
ElseIf Me.mnCenter.Enabled = False Then
clock.Move 7000, 5600, 1500, 400
End If
End Sub

Private Sub rightbottom_Click()


clock.Move 13900, 10650, 1500, 400
Me.righttop.Enabled = True
Me.rightbottom.Enabled = False
Me.mnCenter.Enabled = True
Me.leftbottom.Enabled = True
Me.lefttop.Enabled = True
End Sub

Private Sub righttop_Click()


clock.Move 12900, 10, 1500, 400
Me.righttop.Enabled = False
Me.rightbottom.Enabled = True
Me.mnCenter.Enabled = True
Me.leftbottom.Enabled = True
Me.lefttop.Enabled = True

End Sub

Private Sub Timer1_Timer()


Me.Label1.Caption = Time
Me.Label1.ToolTipText = Format(Date, " dddd, dd MMMM, yyyy")
End Sub
Module Coding
Connection

Public con As New ADODB.Connection


Public conn As New ADODB.Connection
Sub connect()
Set conn = New ADODB.Connection
With conn
.Provider = "Microsoft.Jet.Oledb.4.0"
.ConnectionString = "data source=" & App.Path & "\msflex.ocx;Persist Security
Info=False"
.Open
End With
End Sub

You might also like