Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2010
    Location
    Perth
    Posts
    6

    Cool Problem with filtering on DATE Variable

    I am running the following code in MS Access 2003:



    DoCmd.OpenReport stDocName, acPreview, , "[Equipment Number] ='" & temp & "' & [In] >#" & Format(temp_2, "mm/dd/yyyy") & "#", , temp_2

    The problem is that no data is being shown on the report no matter what the [In] Date Variable is.

  2. #2
    ssanfu is offline Master of Nothing
    Windows 2K Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    DoCmd.OpenReport stDocName, acPreview, , "[Equipment Number] ='" & temp & "' & [In] >#" & Format(temp_2, "mm/dd/yyyy") & "#", , temp_2
    Try:

    DoCmd.OpenReport stDocName, acViewPreview, , "[Equipment Number] ='" & temp & "' AND [In] > #" & Format(temp_2, "mm/dd/yyyy") & "#", , temp_2


    The ampersand ("&") is used to force string concatenation of two expressions.

    The "AND" operator is used to perform a logical conjunction on two expressions


    You might also have problems because "IN" is a reserved word in Access. For a list of reserved words, see

    http://allenbrowne.com/AppIssueBadWord.html

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Date Filtering problem
    By TubbyGrey in forum Access
    Replies: 6
    Last Post: 10-22-2010, 10:46 PM
  2. Replies: 4
    Last Post: 08-05-2010, 01:26 PM
  3. Set date field on subform to date variable
    By laavista in forum Access
    Replies: 4
    Last Post: 06-30-2010, 06:32 PM
  4. set date field on form to date variable
    By laavista in forum Access
    Replies: 3
    Last Post: 06-28-2010, 03:03 AM
  5. Filtering results by date between two datefields
    By lakylekidd in forum Programming
    Replies: 9
    Last Post: 06-07-2010, 07:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums