Results 1 to 2 of 2
  1. #1
    yosik20 is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2011
    Location
    madagascar
    Posts
    5

    Passing form fields criteria to a Query

    Hey,



    I have a form for allowing the user generate report with selection criteria.
    This is a form with 5 Selection Fields - All of them combo-boxes. these fields passes the user selection parameters to a query, for generating the report.

    Passing these combo boxes Values to the Query selection fields is easy; but I don't know how to handle the situation where the user did not select specific value in one filed or more.

    I know I can use 'Is Null' in the query criteria in a specific column for the field - but then I have to make a very complex criteria, resulting in 5 * 5 situations (first field is null, 2-5 are not, second filed is null the others are not etc, etc.)

    any suggestions?

  2. #2
    Rixxe is offline Blessed Bear
    Windows 7 Access 2007
    Join Date
    Sep 2010
    Location
    London (Essex ... yep!)
    Posts
    184
    Not sure if i totally get what you are saying, but if they don't put something into a Textbox, so the result is "" (empty), you then link it to a field in a query so:
    Where TableA.FieldA = TextBox.Text

    Or something similar, wouldn't it just pick up records where that FieldA is empty?

    Or another option, however i'm not sure how easy it would be, is to convert a "" to a NULL. Maybe not convert, but update for example. In this case you could create a query using IF - THEN -ELSE.

    IF textbox is NULL
    Then Change it and run query.
    Else
    Run query normally.

    Hope this helps somewhat. Good Luck.


    Edit: Can you not set the combobox to be NULL by default?

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

Similar Threads

  1. Passing Multi Select string to Query criteria
    By oleBucky in forum Queries
    Replies: 4
    Last Post: 05-15-2011, 02:11 PM
  2. Form not passing data to query
    By bobfin in forum Queries
    Replies: 13
    Last Post: 08-11-2010, 05:28 AM
  3. Passing Criteria to IN statement from Form
    By stephenaa5 in forum Queries
    Replies: 1
    Last Post: 10-09-2009, 04:02 AM
  4. Passing data to sequential form fields
    By jeepfamilyva in forum Forms
    Replies: 0
    Last Post: 06-28-2009, 11:04 AM
  5. Yes/No Fields and Criteria in a Query
    By omicronkappa278 in forum Access
    Replies: 1
    Last Post: 05-22-2009, 09:51 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