Repost - conditional DLookup control source

G

Guest

I am trying to use a DLookup statement as the control source for a textbox,
but I only want to use this IF the value of [0830] on the same form is >=2
otherwise, leave the textbox blank.

A hidden textbox holds the PatientID value, it is the [0830] in the
following statement:

=DLast("[LastName] & ', ' & [FirstName]","tblPatients","[PatientID] =" &
[0830])

Any ideas?

Cheers
 
T

Troy

=IIF([HiddenTextBoxName] = 8030, (PutYourDlookupCodehere),"")

--
Troy

Troy Munford
Development Operations Manager
FMS, Inc.
www.fmsinc.com


I am trying to use a DLookup statement as the control source for a textbox,
but I only want to use this IF the value of [0830] on the same form is >=2
otherwise, leave the textbox blank.

A hidden textbox holds the PatientID value, it is the [0830] in the
following statement:

=DLast("[LastName] & ', ' & [FirstName]","tblPatients","[PatientID] =" &
[0830])

Any ideas?

Cheers
 
G

Graham Mandeno

Hi Paul

Use IIf to check the value of the textbox. Also, use DLookup, not DLast:

=IIf([0830]>=2, DLookup("[LastName] & ', ' & [FirstName]","tblPatients",
"[PatientID] =" & [0830]), Null)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top