By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,530 Members | 2,181 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,530 IT Pros & Developers. It's quick & easy.

Date Comparison in VB 6.0 and Access.. please help meee

P: 3
hi.. i have a problem about date comparison in VB 6.0 and MS Access

i want to compare dates from access to a date from DTpicker control in VB 6.0.. this is my code but it doesnt work coz i get a syntax error..

"Select * from Reservations where DateCheckIn <= #date1# and DateCheckOut > #date1# and [RoomNo] = ' " & cmb_room & " ' "

"Select * from Reservations where #DateCheckIn# <= #date1# and #DateCheckOut# > #date1# and [RoomNo] = ' " & cmb_room & " ' "

notes:
DateCheckIn and DateCheckOut are access fields with Data Type "Date/Time"
date1 and date2 are Values from my two different DTpickers.
Reservations is my table name

both codes give me a syntax error.. can anyone please suggest a better code?

thnx a lot...
Oct 7 '09 #1
Share this Question
Share on Google+
2 Replies


smartchap
100+
P: 236
Visit below link for correction in query (syntax) (use "" before 7 after date1 & date2):
http://www.vbcity.com/forums/topic.asp?tid=32158
I think it will help you solve the problem.
Oct 8 '09 #2

P: 3
thnx a lot... this was very helpful... i kept on playing with the syntax.. thnx again..
Oct 13 '09 #3

Post your reply

Sign in to post your reply or Sign up for a free account.