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

dates problem

100+
P: 121
Hi all
i have access databae in which a table consists of all staff details with dat now if want to retrieve records between 5/01/2008 to 10/01/2008.i dot know the syntax of using between query can u pls help
Jan 12 '08 #1
Share this Question
Share on Google+
5 Replies


QVeen72
Expert 100+
P: 1,445
Hi all
i have access databae in which a table consists of all staff details with dat now if want to retrieve records between 5/01/2008 to 10/01/2008.i dot know the syntax of using between query can u pls help
Hi,

Check this :

SELECT * From MyTable Where MYDate Between #05-01-2008#
And #10-01-2008#

Regards
Veena
Jan 12 '08 #2

100+
P: 121
rs.Open "select * from timesheet where date between #" & mskfrom & "#" And "# & mskTo & #", con, adOpenDynamic, adLockOptimistic

I have written this ode but it giv me runtime error.
pls help
Jan 13 '08 #3

100+
P: 121
rs.Open "select * from timesheet where date between #" & mskfrom & "#" And "# & mskTo & #", con, adOpenDynamic, adLockOptimistic

I have written this ode but it giv me runtime error.
pls help
when writethis code it gives all the records..e if i want to search between 2/01 and 5/01 igives me al recordsof 6/1 ,7/01 so on
Jan 13 '08 #4

100+
P: 121
when writethis code it gives all the records..e if i want to search between 2/01 and 5/01 igives me al recordsof 6/1 ,7/01 so on
i getthis dateproble when i enter in the form of mm/dd/yyyy in mskedbox1 though i have formatted maskedbox as dd/mm/yyyy why is it pls help
Jan 13 '08 #5

Expert 5K+
P: 8,434
i getthis dateproble when i enter in the form of mm/dd/yyyy in mskedbox1 though i have formatted maskedbox as dd/mm/yyyy why is it pls help
You need to show us the exact string which is being passed to Access. The fact that the masked edit control shows something in a particular format on the form doesn't tell us anything about what you're getting out of it.

Pretty sure Access demands U.S. date format (MM/DD/YYYY) so the syntax should be something like...

SELECT * From MyTable Where MyDate Between #01/05/2008# And #01/10/2008#

Alternatively, you might avoid the date format issue by using an unambifuous format. That is, one in which the month and day cannot be confused. For example...

SELECT * From MyTable Where MyDate Between #05-Jan-2008# And #10-Jan-2008#
Jan 13 '08 #6

Post your reply

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