KEMBAR78
Submitted To: Submitted By: Gurmukh Singh R.No.1101776 Jatinder Singh R.No.1101783 Maninder Singh 1101790 | PDF | Microsoft Access | Basic
0% found this document useful (0 votes)
96 views51 pages

Submitted To: Submitted By: Gurmukh Singh R.No.1101776 Jatinder Singh R.No.1101783 Maninder Singh 1101790

This document contains code for a hotel management system developed using Visual Basic 6.0 with MS Access as the backend database. The system allows users to manage hotel bookings and reservations. Key features and forms included are a login form, welcome form, hotel form to add/edit bookings, and code for connecting to and querying the MS Access database where booking records are stored. Visual Basic is used to build the graphical user interface and handle events when users interact with the different forms.

Uploaded by

Ariana Jones
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
96 views51 pages

Submitted To: Submitted By: Gurmukh Singh R.No.1101776 Jatinder Singh R.No.1101783 Maninder Singh 1101790

This document contains code for a hotel management system developed using Visual Basic 6.0 with MS Access as the backend database. The system allows users to manage hotel bookings and reservations. Key features and forms included are a login form, welcome form, hotel form to add/edit bookings, and code for connecting to and querying the MS Access database where booking records are stored. Visual Basic is used to build the graphical user interface and handle events when users interact with the different forms.

Uploaded by

Ariana Jones
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 51

SUBMITTED TO:

Gurmukh Singh
R.No.1101776
Jatinder Singh
R.No.1101783
Maninder Singh
1101790

SUBMITTED BY:

This is certify that restaurant management system embodies the original


work done by Gurmukh Singh, Jatinder Singh & Maninder Singh, during this
project submission as a partial fulfillment of the requirement for system design
project of Bachelor of computer science.

H.O.D
(Computer Science)

The satisfaction that accompanies that the successful

completion of any task

would be incomplete without the mention of people whose ceaseless cooperation


made it possible , whose constant guidance ,encouragement crown all efforts with
success.
I am grateful to my project guide Mr. Gurpret Ghali for the guidance, inspiration
and constructive suggestions that is helpful for me in the preparation of this
project.

This project is used for Restaurant for maintaining the Menu, Editing, etc.
It provides the Empty table as well as Bill information etc.
Technologies to be used
This project is a desktop application to be developed in vb 6.0 having MS access
as backend.
Database design (Ms access)
Form design (VB 6.0)
Coding (VB 6.0)
Testing (VB 6.0)
Reporting tool (Data report)

Visual basic is a tool that allows us to develop windows (Graphical User Interface (GUI))
applications. It is developed by Microsoft corporation USA. The applications have the
familiar appearance to the user. Visual basic is event driven, meaning code remains
idle until called upon to respond to some event.Visual basic is governed by an event processor.

FEATURES OF VISUAL BASIC


Visual basic is an advanced version of basic, an old Programming languages which was largely
usedto teach programming and software development.So visual basic is a popular programming
language to develop common applications for windows. It has following features: Full set of objects.
Lots of icons and pictures for use.
Response to mouse and keyboard actions.
Clipboard and printer access.
Full array mathematical, string handling and graphics functions.
Visual basic handles fixed and dynamic variable and control arrays.
It has useful debugger and error handling facilities.
It has sequential and random access files support.
It has powerful database access tools.
It has action X support.
It package and deployment makes distributing user application simple.
MS Access is used as Backend in VB
MS Access is used as backend in visual basic. MS access is a relational database management
system from Microsoft corporation. Software developers and data architects use the MS access
to develop powerful complex application software. It is used in visual basic to create and store
databases related to visual basic forms.

Creation of database in VB using MS Access

LOGIN FORM

Private Sub Command1_Click ()


If Text1.Text = "Gurmukh" And Text2.Text = "singh" Then
welcome.Show
Else
MsgBox "YOU ARE WRONG G"
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub

WELCOME FORM

Private Sub Command1_Click ()


Form2.Show
End Sub
Private Sub Command2_Click ()
Form1.Show
End Sub
Private Sub Command3_Click ()
Unload Me
End Sub
Private Sub exit_Click ()

Unload Me
End Sub
Private Sub hotel_Click()
Form2.Show
welcome.Hide
End Sub
Private Sub menu Click()
Form1.Show
welcome.Hide
End Sub
Private Sub mnu_Click()
Form4.Show
End Sub
Private Sub us_Click()
Form3.Show
End Sub

HOTEL FORM

Dim conn As adodb.Connection


Dim hotel As adodb.Recordset
Dim flag As Integer
Dim a, f As Boolean
Dim i, j, dd As Integer
Dim adflg As Integer
Dim d, m, Y, t As Integer
Dim res As Integer
Private Sub addcmd_Click()
If adflg = 0 Then
hotel.MoveLast
hotel.AddNew

adflg = 1
a = True
enabling
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Combo1.Text = ""
Combo2.Text = ""
Combo3.Text = ""
Combo4.Text = ""
Combo5.Text = ""
Combo6.Text = ""
Text7.Text = ""
Text9.Text = ""
End If
d = Day(Now)
m = Month(Now)
Y = Year(Now)
Combo1.Text = d
Combo2.Text = m
Combo3.Text = Y
Combo6.Text = Y
flag = 1
Text8.Text = Time$
addcmd.Visible = False
cancmd.Visible = True

f = False
cmdenabling
End Sub
Private Sub cancmd_Click()
res = MsgBox("ARE YOU SHORE TO CANCEL", vbYesNo)
If res = vbYes Then
addcmd.Visible = True
hotel.Delete
If hotel.EOF = False Then
hotel.MoveNext
If hotel.EOF = False Then
fetching
End If
ElseIf hotel.BOF = True Then
hotel.MovePrevious
If hotel.BOF = True Then
fetching
End If
End If
adflg = 0
cancmd.Visible = False
f = True
cmdenabling
End If
End Sub
Private Sub Combo5_LostFocus()
Select Case Combo5.ListIndex

Case 0
dd = 31
Case 1
If Combo6.Text = "" Then
MsgBox "plz fill year first"
End If
i = Val(Combo6.Text) Mod 4
If i = 0 Then
dd = 29
Else
dd = 28
End If
Case 2
dd = 31
Case 3
dd = 30
Case 4
dd = 31
Case 5
dd = 30
Case 6
dd = 31
Case 7
dd = 31
Case 8
dd = 30
Case 9
dd = 31
Case 10

dd = 30
Case 11
dd = 31
End Select
If Combo4.Text <> "" Then
t = Combo4.Text
End If
Combo4.Clear
Combo4.Text = t
For i = 1 To ddDim conn As adodb.Connection
Dim hotel As adodb.Recordset
Dim flag As Integer
Dim a, f As Boolean
Dim i, j, dd As Integer
Dim adflg As Integer
Dim d, m, Y, t As Integer
Dim res As Integer
Private Sub addcmd_Click()
If adflg = 0 Then
hotel.MoveLast
hotel.AddNew
adflg = 1
a = True
enabling
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""

Text6.Text = ""
Combo1.Text = ""
Combo2.Text = ""
Combo3.Text = ""
Combo4.Text = ""
Combo5.Text = ""
Combo6.Text = ""
Text7.Text = ""
Text9.Text = ""
End If
d = Day(Now)
m = Month(Now)
Y = Year(Now)
Combo1.Text = d
Combo2.Text = m
Combo3.Text = Y
Combo6.Text = Y
flag = 1
Text8.Text = Time$
addcmd.Visible = False
cancmd.Visible = True
f = False
cmdenabling
End Sub
Private Sub cancmd_Click()
res = MsgBox("ARE YOU SHORE TO CANCEL", vbYesNo)
If res = vbYes Then

addcmd.Visible = True
hotel.Delete
If hotel.EOF = False Then
hotel.MoveNext
If hotel.EOF = False Then
fetching
End If
ElseIf hotel.BOF = True Then
hotel.MovePrevious
If hotel.BOF = True Then
fetching
End If
End If
adflg = 0
cancmd.Visible = False
f = True
cmdenabling
End If
End Sub
Private Sub Combo5_LostFocus()
Select Case Combo5.ListIndex
Case 0
dd = 31
Case 1
If Combo6.Text = "" Then
MsgBox "plz fill year first"
End If
i = Val(Combo6.Text) Mod 4
If i = 0 Then

dd = 29
Else
dd = 28
End If
Case 2
dd = 31
Case 3
dd = 30
Case 4
dd = 31
Case 5
dd = 30
Case 6
dd = 31
Case 7
dd = 31
Case 8
dd = 30
Case 9
dd = 31
Case 10
dd = 30
Case 11
dd = 31
End Select
If Combo4.Text <> "" Then
t = Combo4.Text
End If
Combo4.Clear

Combo4.Text = t
For i = 1 To dd
Combo4.AddItem (i)
Next
End Sub
Private Sub delcmd_Click()
res = MsgBox("YOU WANT TO DELETE CURRENT RECORD ?", vbYesNo)
If res = vbYes Then
hotel.Delete
If hotel.EOF = False Then
hotel.MoveNext
If hotel.EOF = False Then
fetching
End If
ElseIf hotel.BOF = True Then
hotel.MovePrevious
If hotel.BOF = True Then
fetching
End If
End If
End If
End Sub
Private Sub editcmd_Click()
a = True
enabling
flag = 1
End Sub

Private Sub exitcmd_Click()


conn.Close
Unload Me
End Sub
Private Sub Form_Load()
Set conn = New adodb.Connection
conn.Provider = "Microsoft.Jet.OLEDB.4.0"
conn.Open App.Path & "/hotmgt.mdb"
Set hotel = New adodb.Recordset
hotel.Open "select * from hotmgt", conn, adOpenStatic, adLockOptimistic
hotel.MoveFirst
fetching
a = False
enabling
adflg = 0 ' to addnew operation on add cmd
For i = 1 To 31
Combo1.AddItem (i)
Combo4.AddItem (i)
Next
End Sub
Public Sub fetching()
Text1.Text = hotel.Fields("name")
Text2.Text = hotel.Fields("address")
Text3.Text = hotel.Fields("city")
Text4.Text = hotel.Fields("phno")
Text5.Text = hotel.Fields("nomember")
Text6.Text = hotel.Fields("noroom")

Combo1.Text = hotel.Fields("cindd")
Combo2.Text = hotel.Fields("cinmm")
Combo3.Text = hotel.Fields("cinyy")
Combo4.Text = hotel.Fields("coutdd")
Combo5.Text = hotel.Fields("coutmm")
Combo6.Text = hotel.Fields("coutyy")
Text7.Text = hotel.Fields("daytotal")
Text8.Text = hotel.Fields("time")
Text9.Text = hotel.Fields("allotroom")
End Sub
Public Sub updating()
If flag = 1 Then
hotel.Fields("name") = Text1.Text
hotel.Fields("address") = Text2.Text
hotel.Fields("city") = Text3.Text
hotel.Fields("phno") = Text4.Text
hotel.Fields("nomember") = Text5.Text
hotel.Fields("noroom") = Text6.Text
hotel.Fields("cindd") = Combo1.Text
hotel.Fields("cinmm") = Combo2.Text
hotel.Fields("cinyy") = Combo3.Text
hotel.Fields("coutdd") = Combo4.Text
hotel.Fields("coutmm") = Combo5.Text
hotel.Fields("coutyy") = Combo6.Text
hotel.Fields("daytotal") = Text7.Text
hotel.Fields("time") = Text8.Text
hotel.Fields("allotroom") = Text9.Text
flag = 0

End If
End Sub
Private Sub nextcmd_Click()
a = False
enabling
If hotel.EOF = False Then
hotel.MoveNext
If hotel.EOF = False Then
fetching
Else
hotel.MovePrevious
End If
End If
If adflg = 1 Then
hotel.Cancel
End If
End Sub
Private Sub prevcmd_Click()
a = False
enabling
If hotel.BOF = False Then
hotel.MovePrevious
If hotel.BOF = False Then
fetching
Else
hotel.MoveNext

End If
End If
End Sub
Private Sub savecmd_Click()
res = MsgBox("save data ?", vbYesNo)
If res = vbYes Then
If Text1.Text <> "" And Text2.Text <> "" And Text3.Text <> "" And
Text4.Text <> "" And Text5.Text <> "" And Text6.Text <> "" Then
If Combo1.Text <> "" And Combo2.Text <> "" And Combo3.Text <> ""
And Combo4.Text <> "" And Combo5.Text <> "" And Combo6.Text <> "" Then
updating
hotel.update
adflg = 1
a = False
enabling
Else
MsgBox "plz fill the date of check in and check out"
End If
Else
MsgBox "plz fill requred data"
End If
End If
addcmd.Visible = True
f = True
cmdenabling
End Sub

Public Sub enabling()


Text1.Enabled = a
Text2.Enabled = a
Text3.Enabled = a
Text4.Enabled = a
Text5.Enabled = a
Text6.Enabled = a
Combo1.Enabled = a
Combo2.Enabled = a
Combo3.Enabled = a
Combo4.Enabled = a
Combo5.Enabled = a
Combo6.Enabled = a
Text7.Enabled = a
Text8.Enabled = a
Text9.Enabled = a
End Sub
Private Sub totalcmd_Click()
If Combo5.Text <> Combo2.Text Or Combo6.Text <> Combo3.Text Then
MsgBox " plz fill day your self"
Text7.Text = ""
Text7.SetFocus
End If
If Combo5.Text = Combo2.Text And Combo6.Text = Combo3.Text Then
Text7.Text = Combo4.Text - Combo1.Text
End If
End Sub
Public Sub cmdenabling()
delcmd.Enabled = f

editcmd.Enabled = f
nextcmd.Enabled = f
prevcmd.Enabled = f
exitcmd.Enabled = f
End Sub
Combo4.AddItem (i)
Next
End Sub
Private Sub delcmd_Click()
res = MsgBox("YOU WANT TO DELETE CURRENT RECORD ?", vbYesNo)
If res = vbYes Then
hotel.Delete
If hotel.EOF = False Then
hotel.MoveNext
If hotel.EOF = False Then
fetching
End If
ElseIf hotel.BOF = True Then
hotel.MovePrevious
If hotel.BOF = True Then
fetching
End If
End If
End If
End Sub
Private Sub editcmd_Click()
a = True
enabling

flag = 1
End Sub
Private Sub exitcmd_Click()
conn.Close
Unload Me
End Sub
Private Sub Form_Load()
Set conn = New adodb.Connection
conn.Provider = "Microsoft.Jet.OLEDB.4.0"
conn.Open App.Path & "/hotmgt.mdb"
Set hotel = New adodb.Recordset
hotel.Open "select * from tomtit", conn, adOpenStatic, adLockOptimistic
hotel.MoveFirst
fetching
a = False
enabling
adflg = 0 ' to addnew operation on add cmd
For i = 1 To 31
Combo1.AddItem (i)
Combo4.AddItem (i)
Next
End Sub
Public Sub fetching()
Text1.Text = hotel.Fields("name")
Text2.Text = hotel.Fields("address")
Text3.Text = hotel.Fields("city")

Text4.Text = hotel.Fields("phno")
Text5.Text = hotel.Fields("nomember")
Text6.Text = hotel.Fields("noroom")
Combo1.Text = hotel.Fields("cindd")
Combo2.Text = hotel.Fields("cinmm")
Combo3.Text = hotel.Fields("cinyy")
Combo4.Text = hotel.Fields("coutdd")
Combo5.Text = hotel.Fields("coutmm")
Combo6.Text = hotel.Fields("coutyy")
Text7.Text = hotel.Fields("daytotal")
Text8.Text = hotel.Fields("time")
Text9.Text = hotel.Fields("allotroom")
End Sub
Public Sub updating()
If flag = 1 Then
hotel.Fields("name") = Text1.Text
hotel.Fields("address") = Text2.Text
hotel.Fields("city") = Text3.Text
hotel.Fields("phno") = Text4.Text
hotel.Fields("nomember") = Text5.Text
hotel.Fields("noroom") = Text6.Text
hotel.Fields("cindd") = Combo1.Text
hotel.Fields("cinmm") = Combo2.Text
hotel.Fields("cinyy") = Combo3.Text
hotel.Fields("coutdd") = Combo4.Text
hotel.Fields("coutmm") = Combo5.Text
hotel.Fields("coutyy") = Combo6.Text
hotel.Fields("daytotal") = Text7.Text

hotel.Fields("time") = Text8.Text
hotel.Fields("allotroom") = Text9.Text
flag = 0
End If
End Sub
Private Sub nextcmd_Click()
a = False
enabling
If hotel.EOF = False Then
hotel.MoveNext
If hotel.EOF = False Then
fetching
Else
hotel.MovePrevious
End If
End If
If adflg = 1 Then
hotel.Cancel
End If
End Sub
Private Sub prevcmd_Click()
a = False
enabling
If hotel.BOF = False Then
hotel.MovePrevious
If hotel.BOF = False Then

fetching
Else
hotel.MoveNext
End If
End If
End Sub
Private Sub savecmd_Click()
res = MsgBox("save data ?", vbYesNo)
If rues = vbYes Then
If Text1.Text <> "" And Text2.Text <> "" And Text3.Text <> "" And
Text4.Text <> "" And Text5.Text <> "" And Text6.Text <> "" Then
If Combo1.Text <> "" And Combo2.Text <> "" And Combo3.Text <> ""
And Combo4.Text <> "" And Combo5.Text <> "" And Combo6.Text <> "" Then
updating
hotel.update
adflg = 1
a = False
enabling
Else
MsgBox "plz fill the date of check in and check out"
End If
Else
MsgBox "plz fill requred data"
End If
End If
addcmd.Visible = True
f = True
cmdenabling

End Sub

Public Sub enabling()


Text1.Enabled = a
Text2.Enabled = a
Text3.Enabled = a
Text4.Enabled = a
Text5.Enabled = a
Text6.Enabled = a
Combo1.Enabled = a
Combo2.Enabled = a
Combo3.Enabled = a
Combo4.Enabled = a
Combo5.Enabled = a
Combo6.Enabled = a
Text7.Enabled = a
Text8.Enabled = a
Text9.Enabled = a
End Sub
Private Sub totalcmd_Click()
If Combo5.Text <> Combo2.Text Or Combo6.Text <> Combo3.Text Then
MsgBox " plz fill day youre self"
Text7.Text = ""
Text7.SetFocus
End If
If Combo5.Text = Combo2.Text And Combo6.Text = Combo3.Text Then
Text7.Text = Combo4.Text - Combo1.Text
End If

End Sub
Public Sub cmdenabling()
delcmd.Enabled = f
editcmd.Enabled = f
nextcmd.Enabled = f
prevcmd.Enabled = f
exitcmd.Enabled = f
End Sub

MENU

Dim conn As adodb.Connection


Dim conn1 As adodb.Connection
Dim menu As adodb.Recordset
Dim order As adodb.Recordset
Dim i, j, k As Integer

Private Sub Command2_Click()


Form_Load
Form_Activate
End Sub

Private Sub Command3_Click()


Unload Me
End Sub
Private Sub edtmenu_Click()
Form4.Show
End Sub
Private Sub Form_Activate()
Set conn1 = New adodb.Connection

conn1.Provider = "Microsoft.Jet.OLEDB.4.0"
conn1.Open App.Path & "/order1.mdb"
Set order = New adodb.Recordset
order.Open "select * from order1", conn1, adOpenStatic, adLockOptimistic
tabcombo.Clear
For i = 1 To 20
tabcombo.AddItem (i)
Next

roomcmbo.Clear
For i = 101 To 150
roomcmbo.AddItem (i)
Next
End Sub
Private Sub Form_Load()
Set conn = New adodb.Connection

conn.Provider = "Microsoft.Jet.OLEDB.4.0"
conn.Open App.Path & "/menu.mdb"
Set menu = New adodb.Recordset
menu.Source = "select * from menu"
menu.Open , conn, adOpenStatic, adLockOptimistic
menu.MoveFirst

For i = 0 To 49
Check1(i).Visible = True
Check1(i).Caption = menu.Fields("iname")
Label1(i).Caption = menu.Fields("iprice")
menu.MoveNext
If menu.EOF = True Then
k=i
Exit For
End If

Next
For i = k + 1 To 49
Check1(i).Visible = False
Check1(i).Caption = ""
Label1(i).Caption = ""
Next
End Sub
Private Sub gocmd_Click()
For i = 0 To 14
Form5.Text5(i).Enabled = True ' true the ENABLE
'Form5.Text6(i).Enabled = True
Next
j=0
For i = 0 To 50
If Check1(i).Value = 1 Then
Form5.Label5(j).Caption = Check1(i).Caption
Form5.Label6(j).Caption = Label1(i).Caption
j=j+1
End If
Next
For i = j To 14
Form5.Label5(i).Caption = "" ' for empty the label of form5
Form5.Label6(i).Caption = ""
Form5.Text5(i).Enabled = False

'Form5.Text6(i).Enabled = False
Next
If tabcombo.Text <> "" Then
Form5.tabtxt.Text = tabcombo.Text
Else
Form5.tabtxt.Text = ""
End If
If roomcmbo.Text <> "" Then
Form5.roomtxt.Text = roomcmbo.Text
Else
Form5.roomtxt.Text = ""
End If
Form5.Show
End Sub
Private Sub nextcmd_Click()
If order.EOF = False Then
order.MoveNext
If order.EOF = False Then
fetching
Else
order.MovePrevious
End If
End If
End Sub
Public Sub fetching()
menu.MoveFirst
j=1

For i = 0 To 25
If menu.Fields("icode") = order.Fields(j) Then
j=j+1
Check1(i).Value = 1
Else
Check1(i).Value = 0
End If
menu.MoveNext
Next
If order.Fields(0) <> "" Then
tabcombo.Text = order.Fields(0)
End If
If order.Fields("roomno") <> "" Then
roomcmbo.Text = order.Fields("roomno")
End If
End Sub
Private Sub prevcmd_Click()
If order.BOF = False Then
order.MovePrevious
If order.BOF = False Then
fetching
Else
order.MoveNext
End If
End If
End Sub
Private Sub roomcmbo_Click()

For i = 0 To 49
Check1(i).Value = 0
Next
tabcombo.Text = ""
End Sub
Private Sub savecmd_Click()
res = MsgBox("YOU WANT TO SAVE THE CURRENT ORDER?", vbYesNo)
If res = vbYes Then
menu.MoveFirst
order.AddNew
j=0
For i = 0 To 49
If Check1(i).Value = 1 Then
j=j+1
order.Fields(j) = menu.Fields("icode")
End If
If menu.EOF <> True Then
menu.MoveNext
End If
Next
If tabcombo.Text <> "" Or roomcmbo.Text <> "" Then
If tabcombo.Text = "" Then
order.Fields("tabelno") = "N.A."
Else
order.Fields("tabelno") = tabcombo.Text
End If
If roomcmbo.Text = "" Then

order.Fields("roomno") = "N.A"
Else
order.Fields("roomno") = roomcmbo.Text
End If
order.update
Else
MsgBox "plz select table number or room number"
tabcombo.SetFocus
End If
End If
End Sub
Private Sub tabcombo_Click()
For i = 0 To 49
Check1(i).Value = 0
Next
roomcmbo.Text = ""
End Sub

UPEATE MENU

Dim conn As adodb.Connection


Dim setup As adodb.Recordset
Dim adflag As Integer
Dim i As Boolean
Private Sub addcmd_Click()
If adflag = 1 Then
setup.MoveLast
setup.AddNew
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
i = True

enabling
Text1.SetFocus
adflag = 0
End If
End Sub
Private Sub editcmd_Click()
i = True
enabling
End Sub
Private Sub exitcmd_Click()
conn.Close
Unload Me
End Sub
Private Sub Form_Load()
Set conn = New adodb.Connection
conn.Provider = "Microsoft.Jet.OLEDB.4.0"
conn.Open App.Path & "/menu.mdb"
Set setup = New adodb.Recordset
setup.Open "select * from menu", conn, adOpenStatic, adLockOptimistic
setup.MoveLast
fetch
i = False
enabling
adflag = 1
End Sub
Public Sub fetch()

Text1.Text = setup.Fields("icode")
Text2.Text = setup.Fields("iname")
Text3.Text = setup.Fields("iprice")
End Sub
Public Sub enabling()
Text1.Enabled = i
Text2.Enabled = i
Text3.Enabled = i
End Sub
Private Sub nextcmd_Click()
i = False
enabling
If setup.EOF = False Then
setup.MoveNext
If setup.EOF = False Then
fetch
End If
End If
End Sub
Private Sub prevcmd_Click()
i = False
enabling
If setup.BOF = False Then
setup.MovePrevious
If setup.BOF = False Then
fetch
End If

End If
End Sub
Public Sub update()
setup.Fields("icode") = Text1.Text
setup.Fields("iname") = Text2.Text
setup.Fields("iprice") = Text3.Text
End Sub
Private Sub savecmd_Click()
update
setup.update
i = False
enabling
adflag = 1
End Sub

BILL

Dim i As Integer
Dim conn1 As adodb.Connection
Dim order As adodb.Recordset
Dim conn As adodb.Connection
Dim hotel As adodb.Recordset
Dim res As Integer
Dim temp As Long
Private Sub Command1_Click()
Form2.Show
Unload Me
Unload Form1

End Sub
Private Sub Command2_Click()
welcome.Show
Unload Form1
Unload Me
End Sub
Private Sub del_Click()
For i = 0 To order.RecordCount
If order.Fields("tabelno") = tabtxt.Text Or order.Fields("roomno") = roomtxt.Text
Then
res = MsgBox("YOU WANT TO DELETE CURRENT RECORD ?",
vbYesNo)
If res = vbYes Then
order.Delete
End If
Exit For
Else
order.MoveNext
End If
Next
End Sub
Private Sub Form_Load()
Set conn = New adodb.Connection
conn.Provider = "Microsoft.Jet.OLEDB.4.0"
conn.Open App.Path & "/hotmgt.mdb"
Set hotel = New adodb.Recordset
hotel.Open "select * from hotmgt ", conn, adOpenStatic, adLockOptimistic

hotel.MoveFirst
For i = 0 To 14
If Label5(i).Caption = Label5(i) Then
Label5(i).Caption = ""
Label6(i).Caption = ""
End If
Next

''''''
Set conn1 = New adodb.Connection
conn1.Provider = "Microsoft.Jet.OLEDB.4.0"
conn1.Open App.Path & "/order1.mdb"
Set order = New adodb.Recordset
order.Open "select * from order1", conn1, adOpenStatic, adLockOptimistic
editval
For i = 1 To 20
tabtxt.AddItem (i)
Next
For i = 101 To 150
roomtxt.AddItem (i)
Next
End Sub

Private Sub Form_Unload(Cancel As Integer)


roomtxt.Clear
tabtxt.Clear
For i = 0 To 14
Text5(i).Text = ""

Next
servicetax.Text = ""
gtxt.Text = ""
otherchg.Text = ""
End Sub
Private Sub gotocmd_Click()
Form1.Show
Unload Me
End Sub
Private Sub gtotal_Click()
temp = 0
For i = 0 To 14
If Text6(i) <> "" Then
temp = temp + Text6(i)
End If
Next
If roomcharg.Text <> "" Then
temp = temp + roomcharg.Text
End If
If servicetax.Text <> "" Then

temp = temp + servicetax.Text


End If
If otherchg.Text <> "" Then
temp = temp + otherchg.Text
End If
If roomother.Text <> "" Then
temp = temp + roomother.Text
End If
gtxt.Text = temp
End Sub
Private Sub roomtxt_Click()
Form1.roomcmbo.Text = roomtxt.Text
editval
tabtxt.Text = ""
End Sub
Private Sub Text5_LostFocus(Index As Integer)
If Index = 0 Then
i=0
calculate
End If
If Index = 1 Then
i=1
calculate
End If
If Index = 2 Then
i=2
calculate

End If
If Index = 3 Then
i=3
calculate
End If
If Index = 4 Then
i=4
calculate
End If
If Index = 5 Then
i=5
calculate
End If
If Index = 6 Then
i=6
calculate
End If
If Index = 7 Then
i=7
calculate
End If
If Index = 8 Then
i=8
calculate
End If
If Index = 9 Then
i=9
calculate
End If

If Index = 10 Then
i = 10
calculate
End If
If Index = 11 Then
i = 11
calculate
End If
If Index = 12 Then
i = 12
calculate
End If
If Index = 13 Then
i = 13
calculate
End If
If Index = 14 Then
i = 14
calculate
End If
End Sub
Public Sub calculate()
If Text5(i).Text = "" Then
Text5(i).Text = 1
End If
Text6(i).Text = Text5(i).Text * Label6(i).Caption
End Sub
Public Sub editval()

hotel.MoveFirst
For i = 0 To hotel.RecordCount
If hotel.EOF <> True Then
If hotel.Fields("allotroom") = Form1.roomcmbo.Text Then
nametxt.Text = hotel.Fields("name")
noday.Text = hotel.Fields("daytotal")
Exit For
End If
Else
Exit For
End If
hotel.MoveNext
Next
End Sub

You might also like