PC Review


Reply
Thread Tools Rate Thread

dlook finding NULL

 
 
Mark
Guest
Posts: n/a
 
      10th May 2010
Hi all,

How do I handle this if it is NULL? car_flag_set is Text, it works on
integers if it is null.

vAccumChk = DLookup("[car_flag_set]", "associate_error_summary",
"[associate_id] = txassociate_id")

Thanks!
 
Reply With Quote
 
 
 
 
Douglas J. Steele
Guest
Posts: n/a
 
      10th May 2010
How have you declared vAccumChk?\

If it's declared as Variant, you shouldn't have any problem.

If it's declared as String, wrap the DLookup call in the Nz function.

Incidentally, your DLookup doesn't look correct. I suspect you meant

vAccumChk = Nz(DLookup("[car_flag_set]", _
"associate_error_summary", _
"[associate_id] = " & txassociate_id), "")


--
Doug Steele, Microsoft Access MVP
http://www.AccessMVP.com/DJSteele
(no e-mails, please!)

"Mark" <(E-Mail Removed)> wrote in message
news:2D207348-A6A9-496F-AB15-(E-Mail Removed)...
> Hi all,
>
> How do I handle this if it is NULL? car_flag_set is Text, it works on
> integers if it is null.
>
> vAccumChk = DLookup("[car_flag_set]", "associate_error_summary",
> "[associate_id] = txassociate_id")
>
> Thanks!



 
Reply With Quote
 
vanderghast
Guest
Posts: n/a
 
      10th May 2010
You can use Nz:

vAccumChck= Nz( DLookup( ...), 0 )


where the value in vAccumChck will be 0 if the DLookup was returning a null.
Note that it would be safer to use a variant and to test for NULL, if that
is important:

Dim temp AS variant
temp=DLookup( .. )
if IsNull(temp) then
... ' error? use 0 ?
else
vAccumChck = temp
end if



Vanderghast, Access MVP



"Mark" <(E-Mail Removed)> wrote in message
news:2D207348-A6A9-496F-AB15-(E-Mail Removed)...
> Hi all,
>
> How do I handle this if it is NULL? car_flag_set is Text, it works on
> integers if it is null.
>
> vAccumChk = DLookup("[car_flag_set]", "associate_error_summary",
> "[associate_id] = txassociate_id")
>
> Thanks!


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dlook up on continiouse form Simon Microsoft Access 1 30th Jul 2009 12:03 AM
Finding null Lars Brownie Microsoft Access 4 24th Jul 2008 06:12 AM
Dlook up Access =?Utf-8?B?SkFH?= Microsoft Excel Programming 0 30th Jan 2007 05:14 PM
Finding value if two others are null =?Utf-8?B?U3VzYW4=?= Microsoft Access Reports 2 13th May 2005 05:54 PM
DLook Syntax Help - for Ken Snell Dan Microsoft Access VBA Modules 2 30th Jul 2004 12:50 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:41 PM.