IIF Statment Syntax

G

Guest

I have an option group that can give three numeric results (1,2 or 3). I wish
to turn these into text within the table by using an IIF statement.
Which is the following -

IIf(=1,"sub-contract",IIf(=2,"Machine Tools",IIf(=3,"Tooling")))

However the table doesn't except the syntax.
Is the above statement in the correct format?
And am I using the right method for the results I want?
 
G

Guest

I would, most likely, use a Case statement on the After Update event, rather
than the IIf.

Sharkbyte
 
F

fredg

I have an option group that can give three numeric results (1,2 or 3). I wish
to turn these into text within the table by using an IIF statement.
Which is the following -

IIf(=1,"sub-contract",IIf(=2,"Machine Tools",IIf(=3,"Tooling")))

However the table doesn't except the syntax.
Is the above statement in the correct format?
And am I using the right method for the results I want?

The table can ONLY store the number value selected in the Option
Group, a 1, 2, 3, etc.
The Table Field's datatype must be Number, field size Integer.

You can display a text value for the selected option group on a Form
or in a Report, as well as in a Query.

In a Form or in a Report, to display text (using an IIF statement),
code an unbound text control:

=IIf([OptionGroupName] = 1,"Sub-Contract",IIf([OptionGroupName]=
2,"Machine Tools","Tooling"))

Another method would be to use the Choose function as the unbound
control's control source:
=Choose([OptionGroupName],"Sub-Contract","Machine Tools","Tooling")

Bit it CANNOT be done in a table.
 
G

Guest

Fred is correct. For some reason I was thinking you were trying to convert
the text for another field on a form, not a table.

Sharkbyte
 

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