Results 1 to 6 of 6

Set null value for check box

  1. #1
    Hossein's Avatar
    Hossein is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Oct 2018
    Posts
    11

    Set null value for check box

    Hello dear Friends
    Same as previous time i need your help for solving my issues.

    I am using the checkbox for filtering the data in Status by PTP column.

    Click image for larger version. 

Name:	Co.jpg 
Views:	20 
Size:	99.7 KB 
ID:	35754
    I have 3 statues :

    First = the checkbox filter (PTP final approval) is true (The check box has check) and i see just on record in data sheet list . => This is OK
    Second = the checkbox filter (PTP final approval) is False (The check box doesn't have check) and i see two records in data sheet list . => This is OK
    Third = How can clear the check box value same as default ? to another words i want remove filter from (PTP final approval) column and see all records as well.
    I used Null and "" value but it didn't work.

    Note: I want use Macro for solving this issue and i don't use visual basic environment and learning complicated VBA codes.

    You can find a video for more information as below link (it is 5 MB Size)

    https://1drv.ms/v/s!AlkN80xb8oHognzC6pz_kt5mCpT3

    Many thanks in advance for your kind support.

  2. #2
    Ajax is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    6,131
    most people don't use macros so requirement for a macro answer will probably go unanswered.

    similarly, most will not visit an unknown site. You can zip your db and upload your zipped file to the forum if you want

    You seem to be suggesting that the checkbox is unbound and set to tri state so you can select null and is used as a filter to a form. For the filter to work, it needs to be

    "StatusbyPTP = " & me.chkBoxName & " OR " & me.chkBoxName & " is null"

    or as you suggest, just remove the filter.

    Note you have not provided field or control names, form names or described how your form is constructed, so you will need to change these to whatever you have

    Since you are already using a macro to set the filter, you should be able to change it to the above.

  3. #3
    Hossein's Avatar
    Hossein is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Oct 2018
    Posts
    11
    Many thanks for your answer. i think that I have to use VBA code . but i couldn't found the concept of some VBA argument .
    I uploaded my file as below link. would you please apply your VBA code on it.

    https://1drv.ms/u/s!AlkN80xb8oHogn10czU9J9YKK76N

  4. #4
    Ajax is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    6,131
    I repeat

    similarly, most will not visit an unknown site. You can zip your db and upload your zipped file to the forum if you want

    this includes me

  5. #5
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    4,406
    I'm going to assume you use macro to run query. Then you would need a query that returns records for both checked and not checked. But how do you decide when to run this one? When the form is open and records are loaded, checking box that was checked will turn it to False, not Null. You have to click when False to turn it to Null. I think this would be unreliable.

    Maybe put an option frame on the form with 3 buttons and a frame label that describes what it is for. 1 button for query all checked, 1 for query all not checked, 1 for query both. When macro runs, it checks value of option frame.
    Last edited by Micron; 10-08-2018 at 09:00 AM. Reason: clarification & added info
    - "doesn't work" is no help. Post err msgs and where.
    - Use code tags for code/sql. Implement changes in copies of your database.
    So, like, why do you, like, start a sentence with, like, "so"?

  6. #6
    Peter M is offline Advanced Beginner
    Windows 7 64bit Access 2013 32bit
    Join Date
    Dec 2017
    Posts
    50
    Why doesn't clicking on the drop-arrow in the datasheet view work?

    Click image for larger version. 

Name:	temp.jpg 
Views:	8 
Size:	14.3 KB 
ID:	35775

    If you have multiple filter criteria, I'm not sure how to do this within a macro. That said, looking at your screenshot, I'm not sure how you can tell if the filter is applied or not. It looks like you have a Split Form, how do you apply the Filter criteria without editing the current record?

    Do you have a header to this form? Then all three conditions could be spelled out. (Checked, Unchecked, Both)

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

Similar Threads

  1. Check two combo box if null
    By margzj in forum Access
    Replies: 17
    Last Post: 08-19-2017, 07:10 AM
  2. Replies: 3
    Last Post: 06-30-2017, 09:56 AM
  3. Replies: 4
    Last Post: 01-14-2014, 12:28 PM
  4. How to Check If Two Fields are Null?
    By alpinegroove in forum Programming
    Replies: 5
    Last Post: 01-04-2012, 12:41 PM
  5. Null Check
    By jgelpi16 in forum Programming
    Replies: 2
    Last Post: 06-04-2010, 11:59 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Tech Forums: Microsoft Office Forums