954,566 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Dlookup with null values

hi
pls help me on this..

i'm using this code to get data from record:

MyNum1 = DLookup("[Outcome]", "Remark", _
      "[IDRemark] = Form![SelectTxt]")
OutTxt.Value = MyNum1


my prob is when the data in [Outcome] is null , access having error to still get the null value from the record..
how to deal with this, do I need to put default value for [Outcome] field in case user don't wanna put data in it? or is there other way to handle?

Thanks.

isumasama
Newbie Poster
18 posts since Feb 2006
Reputation Points: 11
Solved Threads: 0
 

I'm assuming Outcome is numeric but it wouldn't have to be but you would change the value for NZ to vbNullString if it is text.

MyNum1 = ]")<strong>Nz(</strong>DLookup("[Outcome]", "Remark", _
      "[IDRemark] = Form![SelectTxt]")<strong>,0)</strong>
OutTxt.Value = MyNum1
boblarson
Junior Poster in Training
79 posts since Jan 2008
Reputation Points: 31
Solved Threads: 8
 

Thanks so much boblarson! It works great!! thanks a lot

isumasama
Newbie Poster
18 posts since Feb 2006
Reputation Points: 11
Solved Threads: 0
 

btw i need to pull image attachment from the record..
can i use the same dlookup? do ineed array to store the data or is there any other way.. plus how to put the attachment in Attachment box in form?
Thanks

MyNum2 = Nz(DLookup("[Attachment]", "Operation", _
      "[IDOp] = Form![SelectTxt]"), vbNullString)
Attachmentt.Value = MyNum2 <--this definitely an error
isumasama
Newbie Poster
18 posts since Feb 2006
Reputation Points: 11
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: