?
Solved

Boolean IsNull Syntax Issue

Posted on 2012-03-26
4
Medium Priority
?
355 Views
Last Modified: 2012-03-26
All,

I am struggling with getting the following syntax to work and wondering if someone can help put it right.

My CboFromState = 1 and CboToState = 2 but each time I parse this code, it skips to the End If instead of doing what I want it to do if values are found in both CboFromState and CboToState.

ElseIf IsNull((Me.CboFromState) = False) And IsNull((Me.CboToState) = False) = True Then 'DATA FOUND IN BOTH FROM AND TO STATE

Any help much appreciated.
CF
0
Comment
Question by:creativefusion
4 Comments
 
LVL 29

Accepted Solution

by:
IrogSinta earned 1000 total points
ID: 37769811
If I wanted to see if both CboFromState and CboToState have data I would use:

     ElseIf Not IsNull(Me.CboFromState) And Not IsNull(Me.CboToState) then
     'DATA FOUND IN BOTH FROM AND TO STATE
0
 
LVL 75

Assisted Solution

by:DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 1000 total points
ID: 37769812
How about:

ElseIf Not IsNull((Me.CboFromState)  And Not IsNull((Me.CboToState)  Then

mx
0
 
LVL 17

Expert Comment

by:Kent Dyer
ID: 37769814
Instead of an IF..ELSE..END If..  Or IF..ELSEIF..  Why not use a CASE Statement instead?  It will force a true condition which would be ideal in this example.

HTH,

Kent
0
 

Author Closing Comment

by:creativefusion
ID: 37769835
Guys, I hope you don't mind. To be fair I have split 50/50 because you both came up with the same answer only seconds between each other.

Thanks guys. Exactly what was needed. It was wrecking my brain!!
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question