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

Help with query statement

Status
Not open for further replies.

TnE

Technical User
Feb 18, 2003
9
0
0
DE
I have a large linked table from a database I do not control. In this table there is a field with long names ( for argument sake let's say the names are Edward, Frederick, and Susan). In my query I have an Iif statement that reads: IIf("Frederick","Fred") Or IIf("Edward","Ed") Or IIf("Susan","Sue"). The idea is to make the standard field entries into a much shorter acronym. When I run the query I get a blank table. Is there a better way to do this? Or was I on the right track and wrote the statement incorrectly?
 
Hi,

The general syntax for Iif is
Iif(Condition, TrueValue, FalseValue)

If your field includes a full name (rather than just a first name), then matching the field against the whole name won't retrieve any partial values, for example "Susan" won't get picked up if the field contains "Susan Smith".

Options are either to match against a first name only, or just use their name as entered on the database - which is likely to be as the user wishes to be known. For example, if they are known as Edward, they sign themselves Edward, but suddely receive a letter "Dear Ed Jones" they might wonder what has happened.

John
 
Thanks, I realized my conditions did not meet the syntax requirements to use the IiF function.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top