View Full Version : Changing Query Fields with a Macro- Can it be done?


annt
07-10-2003, 10:12 AM
I have a query that contains a field with a calculation (a long series of if...then) Forgive me if my terminology is not right.

I would like to be able to change the calculation in that field depending upon user-input on a form.

Here is an illustraion of what I would like to do:

Take query named CALC based on a table with Columns A and B, both containing numeric data. My query includes a column(Field) that I name RESULT: A+B and the query's RESULT adds the data in A & B.

However, the user decides the B should be subtracted from A and via a checkbox on a form, a macro runs (or some sort of programming) that changes to RESULT field in the CALC to be RESULT: A-B.

Can I do this in Access? How?

jtvcs
07-24-2003, 08:41 AM
Since it sounds like you already know how to us IIF in a query, have you considered in the Calculation field testing the value of a checkbox then setting your formula to A-b or A+B, etc. ?? HTH JT