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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

changing information inside of a textbox

Status
Not open for further replies.

WaltLukeIII

Programmer
Jun 28, 2000
199
US
I have a textbox in a report that currently has two fields from a query as the control source
=[field1] & " and " & [field2]
this works well except that sometimes field1 is empty and sometimes field2 is empty. How can I fix this report so that if both field's are populated then it adds the and.
Thanks

Walt III
SAElukewl@netscape.net
 
Give this a try. We may have to include empty-string checks also but first give this a try:

Code:
=[field1] & IIF(Not IsNull([Field1] and Not IsNull([field2]), " and ", "") & [field2]

Post back with results.

Bob Scriver
[blue]Want the best answers? See FAQ181-2886[/blue]


 
Thanks Bob

That worked perfectly I was even able to combine that with another field and eliminate some more redundant fields in a printout.

=[field1] & " " & [field1] & IIf(Not IsNull([Field1]) And Not IsNull([field2])," & ","") & [field2]

Walt III
SAElukewl@netscape.net
 
Glad that I was able to help you.

Bob Scriver
[blue]Want the best answers? See FAQ181-2886[/blue]


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top