Results 1 to 8 of 8
  1. #1
    kathi2005 is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Oct 2011
    Posts
    42

    Check Box easy question

    Have a query by form that works for an inventory search. I want to add a check box control that the user can check if they only want to see results with current inventory. Getting the check box on the form is easy enough. What do I do in the query to show Is Not Null when a check in the box???

  2. #2
    hertfordkc is offline 18 year novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    481

    Here's a possibility..

    Quote Originally Posted by kathi2005 View Post
    Have a query by form that works for an inventory search. I want to add a check box control that the user can check if they only want to see results with current inventory. Getting the check box on the form is easy enough. What do I do in the query to show Is Not Null when a check in the box???
    I understand your question to mean that you don't want any records in which the inventory is either null or zero.
    To do that, I would change the possible null fields to "fieldx:nz([fieldx],0)"
    AND have the checkbox set a filter in the form fieldx >= 0 by using the onclick event.
    You will probably have to requery.

  3. #3
    kathi2005 is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Oct 2011
    Posts
    42
    That kind of works. I need even out of stock items to show up if the check mark is not checked

  4. #4
    hertfordkc is offline 18 year novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    481

    Are you saying that out of stock items show 0 inventory and

    Quote Originally Posted by kathi2005 View Post
    That kind of works. I need even out of stock items to show up if the check mark is not checked
    null items are not carried?
    So take out the calculated field i.e. fieldx:nz(fieldx,0).
    If the box is not checked, the filter is
    >=0

    If the box is checked,the filter is
    >0
    I believe that if there an field entry in the criteria, a null value will not be included.
    If true, then records containing null values would not be reported in either case.

  5. #5
    kathi2005 is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Oct 2011
    Posts
    42
    how do I link the form to the query (that control anyway)

  6. #6
    hertfordkc is offline 18 year novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    481

    I understood your original post to mean that you had a query working

    Quote Originally Posted by kathi2005 View Post
    how do I link the form to the query (that control anyway)
    with a form and displaying fields. That usually means that you are opening a form based on a query. My answers were based on your having a working query operating in conjunction with the form, i.e the form's recordsource. My focus was on adding a filter or filters that worked with the checkbox to modify the results of the underlying query.

    If you were really saying that you had a form based on a table which was displaying desired information, then you should develop a query which is based on that table, then develop a form based on the query. While there are other possibilities, this sequence is easy to follow.

    I don't have enough experience on working with forms based directly on tables to help you beyond believing that what I've already offered might work.

  7. #7
    kathi2005 is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Oct 2011
    Posts
    42
    My form is based on the query, but after the fact it was decided to add the check box to display on item's with stock

  8. #8
    hertfordkc is offline 18 year novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    481

    Please reread my first reply. In it, I noted that

    Quote Originally Posted by kathi2005 View Post
    My form is based on the query, but after the fact it was decided to add the check box to display on item's with stock
    You can use the Onclick event to set the filter to the desired value.

    Look at this link to see two examples of using controls to filter.

    https://www.accessforums.net/forms/c...lds-18541.html

    Db2 mod.mdb
    Db2x.mdb

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

Similar Threads

  1. Probably a very easy question
    By Ext1jdh in forum Queries
    Replies: 4
    Last Post: 08-02-2011, 12:26 PM
  2. Easy Question Need Help With
    By jdusaf in forum Access
    Replies: 1
    Last Post: 03-23-2011, 11:33 AM
  3. Easy question
    By Danzig in forum Access
    Replies: 11
    Last Post: 10-28-2010, 06:48 PM
  4. Easy newbie question
    By pontuse in forum Access
    Replies: 4
    Last Post: 11-08-2009, 08:02 AM
  5. easy checkbox question
    By nelsok in forum Forms
    Replies: 1
    Last Post: 06-09-2006, 05:46 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