|
-
Aug 3rd, 2006, 04:50 AM
#1
Thread Starter
Addicted Member
Problem in searching data
Dear All,
Hope all in good tune.
I am facing a problem. I want to search the records between two dates. I am using the command as:
SELECT *
FROM mybilldet
WHERE customer='(6) SINHA AUTO DISTUBUTOR' and billdate between (01/07/2006 and 31/07/2006)
ORDER BY billdate;
also I have used
SELECT *
FROM mybilldet
WHERE customer='(6) SINHA AUTO DISTUBUTOR' and billdate >=#01/07/2006# and billdate<=#31/07/2006#
ORDER BY billdate;
The billdate field is a date type field. I am using an Access database.
But the above two commands are not working. The records are there in the database from 18/07/2006. If I use
SELECT *
FROM mybilldet
WHERE customer='(6) SINHA AUTO DISTUBUTOR' and billdate >=#18/07/2006# and billdate<=#31/07/2006#
ORDER BY billdate;
then it is working. Can anybody help me out.
Thanks in advance
-
Aug 3rd, 2006, 04:55 AM
#2
Re: Problem in searching data
you must use US date format
VB Code:
WHERE customer='(6) SINHA AUTO DISTUBUTOR' and billdate >=# format(01/07/2006, "mm/dd/yyyy") # and billdate<=# format(31/07/2006, "mm/dd/yyyy") #
access requires date in that order
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Aug 3rd, 2006, 05:06 AM
#3
Hyperactive Member
Re: Problem in searching data
u can also try with this
VB Code:
SELECT *
FROM mybilldet
WHERE customer='(6) SINHA AUTO DISTUBUTOR'
and billdate between '01/07/2006' and '31/07/2006'
ORDER BY billdate;
-
Aug 3rd, 2006, 05:27 AM
#4
Thread Starter
Addicted Member
Re: Problem in searching data
Thanks SHABA. It worked fine. Thank you very very much because I was fool in applying braces in between operator.
-
Aug 3rd, 2006, 05:39 AM
#5
Hyperactive Member
Re: Problem in searching data
plz mark it as resolved if ur problem has been solved
-
Aug 3rd, 2006, 06:26 AM
#6
Thread Starter
Addicted Member
Re: Problem in searching data
Thanks NOSHABA. It worked fine. Thank you very very much because I was fool in applying braces in between operator.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|