replace 2

C

Chris L.

Thanks for the input on my earlier question in
posing "replace".
Unfortunately, I am not looking for the same result for
all records (see below). My equation calculates a unique
answer for each record --I would like to copy this answer
for each record into my table. In other words I would
like to replace the column x1 in my table with the newly
calculated variable that is unique to each record. any
ideas?

THANKS!!!
CL

HI,
How do you replace an empty variable column in a table
with the answer (a new temporary memory variable) of a
calculation already done in VB. Looking for code
examples. THANKS!
CL

Is the value for this column supposed to be the same for
all records;
that is, are all records supposed to get the same result?
 
D

Dirk Goldgar

Chris L. said:
Thanks for the input on my earlier question in
posing "replace".
Unfortunately, I am not looking for the same result for
all records (see below). My equation calculates a unique
answer for each record --I would like to copy this answer
for each record into my table. In other words I would
like to replace the column x1 in my table with the newly
calculated variable that is unique to each record. any
ideas?

THANKS!!!
CL



Is the value for this column supposed to be the same for
all records;
that is, are all records supposed to get the same result?

Is this a calculation that depends only on the other fields in each
record? If that's so, and if the field must always reflect the result
of the calculation based on the other fields and can be recalculated
whenever you need it, then you shouldn't store it at all.

However, if you really do need to calculate the result and store it in
each record (because it depends on transient data or may later be
changed independently) then you can embed the calculation in the update
query:

Dim strSQL As String

strSQL = "UPDATE MyTable " & _
"SET MyField = (some expression involving other
fields)"

CurrentDb.Execute strSQL, dbFailOnError
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top