Link to home
Start Free TrialLog in
Avatar of Becky Edwards
Becky EdwardsFlag for United States of America

asked on

Subtracting one records field from another. Mar06-Feb06 (variance)

I have two fields with data in them.  I want to create a query, add the two fields, and then subtract one from the other.  I don't know how to do it.
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

Are the fields in the same "row"? If so, you can create a calculated field. In a blank column of your query grid, in the Name row:

AddFields: (DateField1 + DateField2)

Same for subtracting them:

SubtractFields: DateField1 - DateField2

This would result in your query having two new fields - one named AddFields and one named SubtractFields.

If either of these could contain Null values, you'd want to use the Nz function:

AddFields: (Nz(DateField1,0) + Nz(DateField2, 0))

ASKER CERTIFIED SOLUTION
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial