Results 1 to 6 of 6
  1. #1
    Jamescdawson is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2012
    Location
    South Wales, UK
    Posts
    98

    Appending more than one filter to a report

    I have created a report which is filtered using the following expression. The dates are entered on a "Report Selector" form and the expression picks up the dates from the two unbound fields txtFrom and txtTo on that From. However, the report returns all records in the report between the dates (as you would expect) - but I want to be able to report on a single record. (Customer name). I therefore want to add a filter after the date filter (below)


    DoCmd.OpenReport "rptIncomingQSplit", acViewPreview, , "[Date Collected] BETWEEN #" & Format(Me.txtFrom, "mm/dd/yyyy") & "# AND #" & Format(Me.txtTo, "mm/dd/yyyy") & "#"

    I understand that I can append another filter after the date filter but I don't know how and I don't know the syntax.



    Ideally, I want to "Report Selector" form to have 3 elements.... Date From , Date TO and Customer Name which I would ideally like to select from a list in a Combo box. I already have the date selection fields set up. I have created a Combo box into which I select the customer name, but I can't get that 3rd element into my DoCmd.

    Can anyone help ?

    Jimbo

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    You keep building a string. If the field is text:

    "[Date Collected] BETWEEN #" & Format(Me.txtFrom, "mm/dd/yyyy") & "# AND #" & Format(Me.txtTo, "mm/dd/yyyy") & "# AND CustomerName = '" & Me.CustomerName & "'"
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Jamescdawson is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2012
    Location
    South Wales, UK
    Posts
    98
    Hi Paul... Long time No posts... Thanks for offering a solution...

    I tried your string but I'm still falling over on the syntax...
    The name of the Combo Box on the report selector form is <<txtCustomer>> Into that Combobox I select the "Known As" (That's the short name of the customer)

    So I'm trying....

    DoCmd.OpenReport "rptIncomingQSplit", acViewPreview, , "[Date Collected] BETWEEN #" & Format(Me.txtFrom, "mm/dd/yyyy") & "# AND #" & Format(Me.txtTo, "mm/dd/yyyy") & "# AND [KnownAs] = '" & Me.txtCustomer & "'"

    But its not working. I'm not getting a failure or syntax error, it simply generates an empty report.

    I'm not understanding the use of the ' and the "

    Jimbo

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Hi Jimbo! Well, the quotes look like this at their simplest:

    http://www.baldyweb.com/wherecondition.htm

    If that's a combo, I'd wonder if the bound column returns the expected value. Can you post the db here?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Jamescdawson is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2012
    Location
    South Wales, UK
    Posts
    98
    Hi Paul.

    Thanks... Got it... I had an extra # in there on a non date filter.

    All now working

    Thanks again

    Jimbo

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Produce report after appending records?
    By Astron2012 in forum Access
    Replies: 14
    Last Post: 02-20-2013, 08:40 AM
  2. Report Filter
    By BFlat in forum Access
    Replies: 3
    Last Post: 05-12-2012, 12:51 AM
  3. Report Filter
    By SFC in forum Reports
    Replies: 4
    Last Post: 01-11-2012, 04:13 PM
  4. Filter Report
    By BorisGomel in forum Reports
    Replies: 2
    Last Post: 06-09-2011, 03:22 PM
  5. Need appending help?
    By asilva in forum Access
    Replies: 6
    Last Post: 02-17-2010, 03:53 PM

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