View Full Version : How can I use "If" "Then" statements in a query?


matthewac
05-21-2002, 08:04 AM
I have a query that is calculating the total # of copies for the month. Some printers have 2 meter readings. The meters rollover at (for simplicity sake) 99. On the next copy the meter says 0. I can calculate the Monthly volume when the meter rolls over for machines with one meter but those with two???? One meter can roll over and the other may not. My meter data table has these fields:

tblMeterData
==============
Hardware
Date (of meter entery)
1stMtr (Number)
2ndMtr (Number)
1stMtrRollover (Yes/No)
2ndMtrRollover (Yes/No)

How can I say If 1stMtrRollover = Yes then perform this calculation Else perform this calculation.

I'm just getting into VBA and I am familiar with If Then Else but not sure how to apply this to a query. I've only used VBA in Forms.

Please Help?
thanks
matthew

RichMorrison
05-21-2002, 08:22 AM
Look in Access Help for "IIf".

It can be used in queries.

RichM