Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Trouble

Status
Not open for further replies.

Caryisms

Technical User
Oct 17, 2001
132
US
How do I write an expression for a text box in a form that will allow a conditional statement based on another field.

ie. If Field 1 = "Primary", then this text box = [Field 2] & " " & [Field 3]

Thanks!
 
Put an unbound text box on the form. In it, type,

=Iif(condition,"text if condition is true","text if condition is false")

The text stuff can be any combination of text and other items on the form. The text box will display whichever value is appropriate based on how your condition tests.
 

The following VBA will do it:
If Field1 = "Primary" Then Textbox = Field2 & " " & Field3

Or set the control source to:

=Iif(Field1="Primary",Field2 & " " & Field3,"")

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top