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

Dan Waters dwaters at usinternet.com
Fri Feb 10 14:59:19 CST 2006


Gustav,

Null was one of many possibilities, but needed to be handled uniquely.  A
second possible value needed to be handled a certain way.  And then
everything else (and they weren't null), all needed to be handled the same
way.

I ended up using:


	If IsNull(xx) Then

	ElseIf

	Else

	End If


Dan 
 
PS - I guess I said Answered too soon!

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock
Sent: Friday, February 10, 2006 2: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