[AccessD] Case Is = Null ?? - Answered!

Gustav Brock Gustav at cactus.dk
Fri Feb 10 14:23:13 CST 2006


Hi Charlotte and Lambert

But why all this Nz trouble and a clumsy Select Case for a simple If-Then, when Case Else neatly catches a Null as shown ...

/gustav

>>> Lambert.Heenan at AIG.com 10-02-2006 21:05:36 >>>
True, but in my experience -limited though it may be :) - if a field holds a
null or an empty string, you often need to do the same thing - report it out
as an exception for instance.

Lambert

-----Original Message-----
From: accessd-bounces at databaseadvisors.com 
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust
Sent: Friday, February 10, 2006 1:29 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Case Is = Null ?? - Answered!


But that doesn't tell you if the variable was null, only that it could have
been either null or a zero length string to start with.

Charlotte


-----Original Message-----
From: accessd-bounces at databaseadvisors.com 
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Heenan, Lambert
Sent: Friday, February 10, 2006 10:24 AM
To: 'Access Developers discussion and problem solving'
Cc: 'Dan Waters'
Subject: Re: [AccessD] Case Is = Null ?? - Answered!


Or, you can do this...

Select Case var & "" 
' above line adds an empty string to our variant variable. This will turn
Nulls in to empty strings, which you can test for.
	Case ""
		' do whatever you need for a Null
	Case "AnotherValue"
		' code
	Case "YetAnotherValue"
		' more code
End Select

So only one Select Case statement needed.

Lambert




More information about the AccessD mailing list