0

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.

2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by isumasama
1

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 = ]")[B]Nz([/B]DLookup("[Outcome]", "Remark", _
      "[IDRemark] = Form![SelectTxt]")[B],0)[/B]
OutTxt.Value = MyNum1
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
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.