Results 1 to 5 of 5

Thread: .FILTER and dates

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 1999
    Location
    flanders, nj 07836
    Posts
    110
    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?

  2. #2
    Hyperactive Member
    Join Date
    Jun 1999
    Posts
    308
    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]

  3. #3

    Thread Starter
    Lively Member
    Join Date
    May 1999
    Location
    flanders, nj 07836
    Posts
    110
    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?

  4. #4
    Hyperactive Member
    Join Date
    Jun 1999
    Posts
    308
    You can use Format function,and you can assign any format for DateTime picker control in DataFormat property.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    May 1999
    Location
    flanders, nj 07836
    Posts
    110
    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
  •  



Click Here to Expand Forum to Full Width