Expression question

G

Guest

Is there an expression equivalent to the IF statement in Excel?

I am trying to change the value of a field when a certain condition is met.

Example...

If field A in a query is Cat and field B is Baby, I want field A to change
the value of Cat to Kitten. This would be ideal but if it is not possible
then could there be a field C created in a query that would return the
result of Kitten based on the above conditions?
 
R

Rick Brandt

Is there an expression equivalent to the IF statement in Excel?

I am trying to change the value of a field when a certain condition
is met.

Immediate-If. Written as...

IIf(Test expression, result if true, result if false)
 
L

Larry Daugherty

Yes, it's named IF; but how and where you use it isn't the same.

Your question implies that you are trying to perform data machinations in
fields in a table. Access tables aren't the same as Excel spreadsheets even
though the data presentation may look similar.

In Access forms are used for massaging data. Tables are used for storing
data.

To do what you want, create a form based on the table in question and put
the IF statement into the AfterUpdate event of the control that displays
"field B".

While in the case of Excel, you're pretty safe posting a "comparison"
question into an Access newsgroup, it isn't too smart to post a question
into a newsgroup that demands that potential responders know some totally
different application intimately.

HTH
 
Top