Update two fields in a Query

  • Thread starter Thread starter Steve s.
  • Start date Start date
S

Steve s.

I need to update two fields in a table. The second field
is updated (or not) based on the new updated value of the
first field. Can I do this? So far the only way I can
get it to work is to create a second update query to run
after the first is complete. If I try to update both
fields in the same pass I get an error that access can
not recognize the updated first field name in the second
update function.

Steve
 
Steve said:
I need to update two fields in a table. The second field
is updated (or not) based on the new updated value of the
first field. Can I do this? So far the only way I can
get it to work is to create a second update query to run
after the first is complete. If I try to update both
fields in the same pass I get an error that access can
not recognize the updated first field name in the second
update function.

Show us the SQL for your query.

Where does the criteria for the 2nd column update come from? Is it
always the same value or does it change according to the old value of
the 1st column, or some other variable?
 
I need to update two fields in a table. The second field
is updated (or not) based on the new updated value of the
first field. Can I do this? So far the only way I can
get it to work is to create a second update query to run
after the first is complete. If I try to update both
fields in the same pass I get an error that access can
not recognize the updated first field name in the second
update function.

Steve

The update event happens "all at once" so the second field will not be
able to depend on the first.

I have to wonder about the normalization of your data - if the second
field can be calculated based on the first, perhaps it should not
exist in your table at all! Instead, can you calculate it on the fly
in a Query? If you do need to store it, can you calculate it based on
the same expressions as you're using to generate the first field?
 
Your first sentence answered my question, thanks. I
agree that this database is not normalized to the Nth
degree but that may be due to my assembler training in
the 70s. A CPU stroke saved.... I thought it may be
better to calculate and store this value once than to
calculate it hundreds or thousands of times in the
future.

Thanks for your help.

Steve
 
Back
Top