Can I make a conditional (if then) expression in Access?

A

aokhan

I have a calculated variable R. I want to build an expression in a query such
that another variable Rag = R unless R<7 in which case Rag=7. In other words,
If R<7 then Rag=7 else Rag=R. Is this possible ... I can't figure out how to
do it... thanks.
 
A

aokhan

Thanks, it worked!

Allen Browne said:
See help on the Immediate If function:

=IIf([R] < 7, 7, [R])

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

aokhan said:
I have a calculated variable R. I want to build an expression in a query
such
that another variable Rag = R unless R<7 in which case Rag=7. In other
words,
If R<7 then Rag=7 else Rag=R. Is this possible ... I can't figure out how
to
do it... thanks.
 
A

aokhan

Another issue I'm having is actually printing or copying an expression that
I've made. Do you know how to copy and/or print the formula in an expression?
The usually "copy" and "print" options are unavailable when I try.

Thanks,

Allen Browne said:
See help on the Immediate If function:

=IIf([R] < 7, 7, [R])

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

aokhan said:
I have a calculated variable R. I want to build an expression in a query
such
that another variable Rag = R unless R<7 in which case Rag=7. In other
words,
If R<7 then Rag=7 else Rag=R. Is this possible ... I can't figure out how
to
do it... thanks.
 
A

Allen Browne

Presumably this is in the context of a query.

You can copy the field with Ctrl+C, and then paste into Notepad.

You can see the expression by pressing Shift+F2 to show the Zoom window.

You can see the entire SQL statement by choosing SQL View from the View
menu.
 
Top