Multiple Expressions in Query

Matt Rayne

Registered User.
Local time
Today, 15:28
Joined
Jan 8, 2003
Messages
18
Hello Everyone:

I have a query that I need to pull specific information from a table.

Would like to have it show a records contract date as a month number if the closed date is null (that's easy enough). I also want it to show the closed date as a month number if the closed date is less than or equal to the contract date + 120 days.

Here is what I have so far.

IIf(IsNull([Close Date]), month([Contract Date]), "") or IIf([Close Date] <= [Contract Date] + 120, month([Close Date]), "")

This returns a negetive number. The reason I want it to be a month number is so that when they run a report against the query it will as them to enter a month number and they will only get back info for that month. (Records with a contract date that month and records with a closed date that month that were closed in under 120 days from the contract date)

Thanks for all the help out there you guys make me look like a superstar.

Matt
 
Try this:-

IIf(IsNull([Close Date]), month([Contract Date]), IIf([Close Date] <= [Contract Date] + 120, month([Close Date]), Null)


Note: It will exclude those records (i.e. return Null) where [Close Date] > [Contract Date] + 120
 
Thanks Jon

That worked great. One small step for Jon, one giant leap for Matt:)
 

Users who are viewing this thread

Back
Top Bottom