Filtering Access database question

Results 1 to 3 of 3

Thread: Filtering Access database question

  1. #1
    Dan Schmidt Guest

    Default Filtering Access database question

    I am trying to filter an access database on the date:<BR><BR> What I am trying to do is only pull up records in the table that have a date in their date field that is equal to the present date and up to three months in the future.<BR><BR>somthing along these lines, <BR><BR>objrec.Filter = "eventdate &#062;= &#039now()&#039"<BR>this isnt working:<BR>i think it is looking at &#039now()&#039 as the actuall string<BR>I even tryed to create a string var with the date:<BR>tempstr = cstr(month(now))<BR> temp2 = cstr(day(now))<BR> temp23 = cstr (year(now))<BR> tempfin = tempstr & "/" & temp2 & "/" & temp23<BR> then <BR>obrec.filter "eventdate &#062;= &#039tempfin&#039"<BR><BR>

  2. #2
    Dan Schmidt Guest

    Default Filtering Access database question continued

    obrec.filter "eventdate &#062;= &#039tempfin&#039" doesnt work either.<BR><BR>how do you filter an access database with a value stored in a variable and not a literal string?<BR>Is there a better way?

  3. #3
    Matt Braun Guest

    Default RE: Filtering Access database question continued

    Try eventdate &#062; #" & now() & "#<BR><BR>may still need some formatting in order to compare -- use formatdatetime(eventdate,1) &#062; #" & formatdatetime(now(),1) & "#<BR><BR>Your mistake is the inclusion of the now() withing " " and/or &#039&#039, the SQl reads that as a string, and ASP does not insert the value.<BR><BR>Hope this helps.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •