|
-
May 21st, 2000, 11:46 PM
#1
Thread Starter
Lively Member
Using DAO I cant get a filter to work for dates..
First question, is posting just NOW into a date/time field for access mdb if I want to search just by date later down the road?
Second I just can't get it to work except for literals, which doesn't help me.
I've tried using the datevalue converted mentioned in MSDN and everything so.. anyone can help me please?
How can I apply the filter for a day that the user can pick or by a range?
-
May 22nd, 2000, 02:15 AM
#2
Hyperactive Member
Hi, there.
Posting NOW in date/time field gives you every day different value, so there is no problem for searching database later on.
You can use:
sSQL = "select * from orders where orderdate between " & Chr(35) & Text1.Text & Chr(35) & " and " & Chr(35) & Text2.Text & Chr(35)
for range of dates. Assuming that user enters date range in text boxes.
If you are looking for a specific date, than use:
sSQL = "select * from orders where orderdate=" & Chr(35) & Text1.Text & Chr(35)
Chr(35) stands for # sign.
I didn't understand your second question. If you're afraid that user can enter invalid date, you can use DateTime picker control.
[Edited by LG on 05-22-2000 at 03:20 PM]
-
May 22nd, 2000, 02:27 AM
#3
Thread Starter
Lively Member
that doesn't work unless you enter the date in exactly as it is in the db.
ie I have some ticket with 5/22/2000 as the date
if you put in 05/22/2000 or 5/22/00 you won't see the tickets..
using adoprimaryrs.filter "DateofFirstCall = #" & result & "#"
result is inputbox return...
Should I just try to format the numbers and cross my fingers it works down the road?
-
May 22nd, 2000, 02:44 AM
#4
Hyperactive Member
You can use Format function,and you can assign any format for DateTime picker control in DataFormat property.
-
May 22nd, 2000, 02:45 AM
#5
Thread Starter
Lively Member
that's what I thought.. I'll just have to put super tight control on the fields and make them un editable.. thanks man..
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
|