I have a booking system that was working all nicely. It done everything it was supposed to.
Today I was demonstrating the system I made (for my degree) to my supervisor and it suddenly dosent work! Was not amused!
I've figured out that something is changing the format of the date (from british to USA), between the sql statement my VBA excecutes and the data being put in the table.
It worked fine so I cannot figure out why it dosen't now when nothing has changed!
Here is the VBA code:
Can anyone solve the mystery?
Emma
Today I was demonstrating the system I made (for my degree) to my supervisor and it suddenly dosent work! Was not amused!
I've figured out that something is changing the format of the date (from british to USA), between the sql statement my VBA excecutes and the data being put in the table.
It worked fine so I cannot figure out why it dosen't now when nothing has changed!
Here is the VBA code:
Code:
Private Sub add_booking_Click()
Dim dteBookDate As String
Dim dteLeaveDate As String
Dim nightnum As Integer
dteBookDate = Forms("booking2").date1
dteLeaveDate = Forms("booking2").date2
nightnum = Forms("booking2").nights
DoCmd.RunSQL "INSERT INTO booking VALUES (" & Forms("booking2").[room_no] _
& ", #" & dteBookDate & "#, " & Forms("booking2").[Cust_no] & ", " & False & ", " & nightnum & " );"
dteBookDate = DateAdd("d", 1, dteBookDate)
Do While dteBookDate < dteLeaveDate
DoCmd.RunSQL "INSERT INTO booking VALUES (" & Forms("booking2").[room_no] _
& ", #" & dteBookDate & "#, " & Forms("booking2").[Cust_no] & ", " & False & "," & 0 & ");"
dteBookDate = DateAdd("d", 1, dteBookDate)
Loop
DoCmd.RunMacro "book_room"
End Sub
Can anyone solve the mystery?
Emma