Using DateDiff with an IIf function in Access 2007?

teresamichele

Registered User.
Local time
Yesterday, 20:22
Joined
Oct 18, 2010
Messages
13
Hi! I'm trying to do something fairly straight-forward, I think, but I've hit a wall. I'm using Access 2007 to create a form for project entry.

My form has a date logged, a date due, and a Priority field.

I figured out DateDiff so that it will tell me the difference between date logged and date due - I entered that as the control source for the text box for Priority. What I'm trying to do NOW is instead of "30" popping up in the "Priority" field, have the letter code A show up.

Is there a way to nest the DateDiff function in an IIf function so that I can just put the whole thing as the control source for that box or am I making things overly complicated?

Any help would be appreciated! :)

Teresa
 
Sure:

=IIf(DateDiff(...) = 30, "A", "B")
 
I tried something like that and it didn't work (I'm sure it was user error). So instead, because I hate having a problem I can't solve, I created a hidden field that calculates the difference between the current date and the due date, and then used the value of THAT in the IIf function in the Priority field.

On the upside, it will now realize when a project moves to a more urgent priority code. Yay!

Thanks, though!

Teresa
 
Hard to say what may have been wrong without seeing it, but glad you found a solution.
 

Users who are viewing this thread

Back
Top Bottom