Repost - conditional DLookup control source

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
=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
 
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)
 
Back
Top