Results 1 to 4 of 4
  1. #1
    santinimatias is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Nov 2013
    Posts
    13

    Filtering Report (with subreports) from a list box and two "date" textboxes.

    (windows 7 & Access 2013)
    I'm really lost on this one. There's a lot of information around that can help, but I haven't been able to mix and match to my needs.
    I need to be able to print the report from either multiple selection or "ALL" customers, filtered from a listbox and two textboxes that defines the date range and a button to open the report.

    The form has the
    "lstCustomers" listbox,
    "OrderDate1" unbound textbox,
    "OrderDate2" unbound textbox, and
    the "cmdOpenreport" button.

    The report has six subreports (Printing, Scanning, Shipping, Mounting, Mileage and CD burning) and each subreport's Record source is based on a query.

    So far, I've been able to have the listbox to show each customer, plus the "All" at the top of the list. The code for this is shown below:
    Code:
    SELECT Customers.CustomerID, [ProjectNumber] & " - " & [ProjectName] AS Customer, Customers.ProjectName, Customers.ProjectNumber 
    FROM Customers 
    WHERE ((Not (Customers.ProjectName)="Admin")) 
    UNION Select "0", "(All)" as Bogus, Null, Null as AllChoice  
    From Customers
    ORDER BY ProjectNumber;
    HERE is where I am stuck!
    I've been trying all sort of methods, from Allen Browne (http://allenbrowne.com/ser-50.html) to other websites/forums.
    I can't seem to make anything work!

    On one side, Allen Browne says it is better to avoid filtering through queries and instead using the WHERE option within the report to create the desired filter. The problem I see on this approach is the fact that It runs 6 subreports. How can I apply this to each subreport?


    On the other hand, I could try to do the filtering from the queries, but I understand that it is not possible for the query to get the multiple selection from the listbox.

    Any help is welcome!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Is the main report bound to Customers table? The subreport container Master/Child Links properties will synchronize the related records. If you need to apply any additional filter criteria such as date range to the subreports, possible options:

    1. compound Master/Child Links but don't think will work for date range criteria
    2. dynamic parameterized query for the subform RecordSource
    3. set the subform Filter property
    4. set filter in subreport Grouping & Sorting features

    2 - 4 would reference the form controls for parameters.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    santinimatias is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Nov 2013
    Posts
    13
    Thank you for your response.
    I do have the parent/child relationship using the CustomerID field.
    Could you describe the items 2 & 4 of your list? I am at a loss here.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Example of dynamic parameterized query http://www.datapigtechnologies.com/f...mtoreport.html

    Sorry, I mis-spoke about item 4 - ignore it.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 3
    Last Post: 02-16-2015, 01:04 PM
  2. Replies: 3
    Last Post: 12-23-2014, 01:00 AM
  3. Replies: 3
    Last Post: 12-06-2014, 03:59 AM
  4. Replies: 2
    Last Post: 09-29-2012, 11:22 PM
  5. Replies: 11
    Last Post: 03-29-2012, 02:32 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