Results 1 to 8 of 8
  1. #1
    bcarter17 is offline Advanced Beginner
    Windows 10 Access 2007
    Join Date
    Jun 2021
    Location
    Richmond MO
    Posts
    35

    Criteria....Sometimes YES, sometimes NO

    Hello,
    On some of our reports, we query a particular customer and in some instances, we need to request the report show a particular PO number. At other times, we need the report to print all PO numbers. Also, some customers don't use PO numbers so that field is blank. I tried to enter criteria request like [Enter PO Number], but if I leave it blank as I expected it returns nothing.



    Example - Customer Smith has multiple PO's 001, 002, 003, 004 and 005. I might need to just print 002, or at times I need to print all 5. Then, sometimes Smith will not use a PO number and the field is blank. So I would need to remove the criteria for the user and pull all 5 PO's and the orders with no PO number into one report.

    Any workarounds on this, I used to have this issue with Access 2003 and never found a good fix. I now am using 2007.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,523
    I have a tPicked list, user adds items to it by dbl-clicking (like POs) runs append qry.
    you then join tPicked to the main data table and only those item will pull.
    Attached Thumbnails Attached Thumbnails pick state lbls.png  

  3. #3
    bcarter17 is offline Advanced Beginner
    Windows 10 Access 2007
    Join Date
    Jun 2021
    Location
    Richmond MO
    Posts
    35
    That's a great workaround. So how would this work if some of the selections I needed, the field was blank (for example in your application, US Virgin Islands)?

    Also, if the report needed to pull "ALL", then how do you set it up to not use the tPickedList? VBA code prior to execution to make a decision on using one method or another?

    Can you show me the setup and code for your tPickedList form?

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    Can you post a copy of your database (zip format)?

  5. #5
    bcarter17 is offline Advanced Beginner
    Windows 10 Access 2007
    Join Date
    Jun 2021
    Location
    Richmond MO
    Posts
    35
    Here you go!
    Attached Files Attached Files

  6. #6
    ssanfu is offline Master of Nothing
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Quote Originally Posted by bcarter17 View Post
    On some of our reports, we query a particular customer and in some instances, we need to request the report show a particular PO number. At other times, we need the report to print all PO numbers. Also, some customers don't use PO numbers so that field is blank.
    How to get to the report(s)? What report names?

  7. #7
    Join Date
    Jun 2010
    Location
    Belgium
    Posts
    1,042
    Have you already tried something as

    "*" & NZ([Fieldname) & "*"

    with the like operator?

  8. #8
    Cottonshirt is offline Competent Performer
    Windows 8 Access 2007
    Join Date
    Feb 2018
    Posts
    116
    you want a report that runs from a parameter, AND you want a blank parameter to mean ALL records.


    this is the example I use in a query, I guess it should work for a report. pay attention to the WHERE statement:

    Code:
    SELECT tbl_spool_file.supplier_in, tbl_spool_file.date_in, tbl_spool_file.po_number, tbl_spool_file.line_po, tbl_spool_file.part_number
    FROM tbl_spool_file
    WHERE ((([enter a po number]) Is Null)) OR (((tbl_spool_file.po_number)=[enter a po number]) AND (([enter a po number]) Is Not Null))
    ORDER BY tbl_spool_file.po_number, tbl_spool_file.line_po;

    good luck with your project



    Cottonshirt

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

Similar Threads

  1. Replies: 2
    Last Post: 09-25-2020, 10:39 AM
  2. Replies: 1
    Last Post: 08-15-2016, 05:56 AM
  3. Replies: 2
    Last Post: 04-02-2015, 12:45 PM
  4. Replies: 4
    Last Post: 08-30-2014, 10:23 AM
  5. Replies: 5
    Last Post: 08-02-2012, 09:44 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