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

Charlotte Foust cfoust at infostatsystems.com
Fri Feb 10 15:50:44 CST 2006


I didn't say I would necessarily do it that way, Gustav.  I was just
answering the question asked on using a Select Case. :o}  I often use
Case Else, but if there is a reason for knowing explicitly that the
value of the variable was null, a Case Else might not be specific
enough.  Depends on what you want/need to do.

Charlotte Foust


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock
Sent: Friday, February 10, 2006 12:23 PM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] Case Is = Null ?? - Answered!


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

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list