Elephant
Registered User.
- Local time
- Today, 05:01
- Joined
- Nov 22, 2002
- Messages
- 52
I am developing a database for a travel company.
Attached is a small test part of that database where I am trying to input dates of hotel stay in a form and have price of stay automatically calculated.
For some reason the code used in the Form "Hotels Frm" does not work and I get a syntax error. Could someone kindly check it and let me know why there is a problem (and what to change) as I just can't figure it out ... you need to go to the form "Hotels frm", choose a hotel, room, and then arrival and departure date ...
The code in question is :
Set rst = CurrentDb.OpenRecordset("SELECT [HotelPrices tbl].[Price] " _
& "FROM [HotelPrices tbl] " _
& "INNER JOIN [Hotels tbl] ON " _
& "[HotelPrices tbl].HotelId = [Hotels tbl].HotelID " _
& "WHERE ((([Hotels tbl].[HotelName]) = '" & Me.[cmbHotelName] & "') " _
& "And (([HotelPrices tbl].[SeasonStartDate]) < #" & Me.[txtFromDate] & "#) " _
& "And (([HotelPrices tbl].[SeasonEndDate]) > #" & Me.[txtFromDate] & "#)) " _
& "GROUP BY [HotelPrices tbl].[Price];")
Price = rst![Price]
The error message I got was :
Run-time error '3075'
Syntax error in date query expression
'((([Hotels tbl].[HotelName]) = 'Sunshine Villa') And (([HotelPrices tbl].[SeasonStartDate]) < #23.3.2003#) And (([HotelPrices tbl].[SeasonEndDate]) > #23.3.2003#))'.
THANKS!
Steve
Attached is a small test part of that database where I am trying to input dates of hotel stay in a form and have price of stay automatically calculated.
For some reason the code used in the Form "Hotels Frm" does not work and I get a syntax error. Could someone kindly check it and let me know why there is a problem (and what to change) as I just can't figure it out ... you need to go to the form "Hotels frm", choose a hotel, room, and then arrival and departure date ...
The code in question is :
Set rst = CurrentDb.OpenRecordset("SELECT [HotelPrices tbl].[Price] " _
& "FROM [HotelPrices tbl] " _
& "INNER JOIN [Hotels tbl] ON " _
& "[HotelPrices tbl].HotelId = [Hotels tbl].HotelID " _
& "WHERE ((([Hotels tbl].[HotelName]) = '" & Me.[cmbHotelName] & "') " _
& "And (([HotelPrices tbl].[SeasonStartDate]) < #" & Me.[txtFromDate] & "#) " _
& "And (([HotelPrices tbl].[SeasonEndDate]) > #" & Me.[txtFromDate] & "#)) " _
& "GROUP BY [HotelPrices tbl].[Price];")
Price = rst![Price]
The error message I got was :
Run-time error '3075'
Syntax error in date query expression
'((([Hotels tbl].[HotelName]) = 'Sunshine Villa') And (([HotelPrices tbl].[SeasonStartDate]) < #23.3.2003#) And (([HotelPrices tbl].[SeasonEndDate]) > #23.3.2003#))'.
THANKS!
Steve
Attachments
Last edited: