• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 646
  • Last Modified:

IF Statement in MS Access

To whom it may concern,

I need to say the following in MS Access, but I think that I am missing smth in my SQL code. Could someone tell me how to make the following work?

Expression1 is the field in my design view and the rest is the values that I want my field to assume.

Expression1: If ((var1>0 and var2=#12/31/9999#), min(var3,var1),var4)

-Maroulator
0
maroulator
Asked:
maroulator
1 Solution
 
IrogSintaCommented:
You need to use IIf inside an expression rather than IF.  
As for min(var3,var1), that is not how the MIN function works in Access.  I'm assuming you are trying to get the lower value of the two values (var1 and var3).  If so your expression should go something like this:
IIf ((var1>0 and var2=#12/31/9999#), IIf(var3<var1,var3,var1),var4)

Open in new window

0
 
mark_harris231Commented:
Disregard - IrogSinta beat me to the punch  ;)
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Tackle projects and never again get stuck behind a technical roadblock.
Join Now