Solved

Boolean IsNull Syntax Issue

Posted on 2012-03-26
4
347 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 250 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 - Access MVP)
DatabaseMX (Joe Anderson - Access MVP) earned 250 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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.

911 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now