Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Help   Contact   Merch   Join   Order   Logon   Forums   
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
How to Capture is Null Value From a Form Object
David Garcia 
    
2 months ago
Hello,
I have a query having criteria reference from Form objects.  For Example, In Query Design column, ReceiveDate criteria has >=[Forms]![Frm_C_NewPatient_Annotation_WorkList]![txt_FromDate_Search].[Value] And <=DateAdd("d",1,[Forms]![Frm_C_NewPatient_Annotation_WorkList]![txt_ToDate_Search].[Value])  This works great.
In another Query Design column called, LockedUser i can insert Is Null in Criteria to query records having LockedUser is Null.  Now, i want to change Is Null and instead reference a checkbox that i can toggle back and forth between Is Null and Is Not Null.  Having trouble with this.  I just learned that IIF in criteria can not reture Is Null or Is Not Null. I also tried referencing a Public Function from My criteria but, couldn't get that to work.  Can someone assist with my issue?
Thank You, David Garcia,
Houston, TX
David Garcia OP  @Reply  
    
2 months ago

Donald Blackwell  @Reply  
       
2 months ago
Have you tried the IsNull() function instead the statements.

For example:

Iif(isNull(MYFIELD), ACTION_IF_NULL, ACTION_IF_NOT_NULL)

or for the negative:

Iif(Not IsNull(MYFIELD), ACTION_IF_NOT_NULL, ACTION_IF_NULL)
David Garcia OP  @Reply  
    
2 months ago
Hi Donald,

What i am trying to do is, i have this checkbox on Form as default shows as ,  [ ] Is Null.  User can toggle back and forth from showing [ ] Is Null to showing [ ] is Not Null.  This is just visual for user.  But every time User clicks the checkbox it fires a Me.Requery.

The query that fires has a Field: LockedDate.  So the user is suppose to be able to see records having LockedDate field with Null values or with our Null Value.
In Query Criteria in LockedDate column i have,
IIf([Forms]![Frm_C_NewPatient_Annotation_WorkList]![Chk_LockedBy]=True,([dbo_C_NewPatient_Annotation].[LockedDate]) Is Null,([dbo_C_NewPatient_Annotation].[LockedDate]) Is Not Null).  [Chk_LockedBy] object is the checkbox.
I cannot seem to get the correct syntax entered to get this logic to work.
I can create 2 Queries, one for showing LockedDate having Nulls and other query showing LockedDate having Not Nulls.  But i was trying to avoid this and put logic in 1 query instead.  is this possible?

Donald Blackwell  @Reply  
       
2 months ago
OK, think I figured out what is going on.

If you're trying to use the Query Editor (QBE), it "double" lists the name of your criteria field, just like you showed in your last example and that is why it isn't showing any records.

To fix it, you'll have to edit the SQL directly

If this is the only criteria, it would look something like the following:

SQL WHERE (click to expand)WHERE
     iif(Forms!Form_C_NewPatient_Annotation_Worklist!Chk_LockedBy,
     dbo_C_NewPatient_Annotation.LockedDate Is Null,v
     dbo_C_NewPatient_Annotation.LockedDate Is Not Null);


If you have other criteria, just place a comma after the last one and before the semi-colon and then paste this code and if I didn't mystype any of your form/field names, it should work for you.
Donald Blackwell  @Reply  
       
2 months ago
SQL WHERE without the "v" typo (click to expand)WHERE
     iif(Forms!Form_C_NewPatient_Annotation_Worklist!Chk_LockedBy,
     dbo_C_NewPatient_Annotation.LockedDate Is Null,
     dbo_C_NewPatient_Annotation.LockedDate Is Not Null);

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 7/26/2026 2:59:08 AM. PLT: 1s