Hi,
Still trying to make my booking system! I'm trying to make a loop that will check in a guest for each booking night of stay. (each booked night has 1 record and all it needs to do is give checkin a true value).
Now the query part isn't working. It works as an access query but not when i convert it to vba. Am working on the first query at the momment, not the second.
I'm thinking it's just something small (hopefully). I just can't find it. I've attatched a little test database that I have been using to try and figure it out.
Any help is greatly appreciated.
Emma
My other posts to do with my booking system can be found:
Booking System Dates
Insert Statement
Still trying to make my booking system! I'm trying to make a loop that will check in a guest for each booking night of stay. (each booked night has 1 record and all it needs to do is give checkin a true value).
Now the query part isn't working. It works as an access query but not when i convert it to vba. Am working on the first query at the momment, not the second.
Code:
Private Sub checkin_button_Click()
Dim dteBookDate As Date
Dim nights As Integer
Dim count As Integer
dteBookDate = CDate(Forms("form").date)
nights = Forms("form").nights
count = 0
Do While count < nights
DoCmd.RunSQL "UPDATE table1 SET table1.checkin = True WHERE (((book_room)=" & Forms("form").[roomno] _
& ") AND ((date)= #" & dteBookDate & "#));"
DoCmd.RunSQL "INSERT INTO breakfastpaper VALUES (#" & dteBookDate & "#, " & Forms("checkin2").[roomno] & "," _
& Forms("checkin2").[breakfast] & ", " & Forms("checkin2").[paper_code] & ");"
dteBookDate = DateAdd("d", 1, dteBookDate)
count = count + 1
Loop
DoCmd.RunMacro "checkin2"
End Sub
I'm thinking it's just something small (hopefully). I just can't find it. I've attatched a little test database that I have been using to try and figure it out.
Any help is greatly appreciated.
Emma
My other posts to do with my booking system can be found:
Booking System Dates
Insert Statement
Attachments
Last edited: