replace

  • Thread starter Thread starter Chris L.
  • Start date Start date
C

Chris L.

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
 
Chris L. said:
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? If so, you
can build the calculated value into a single update query and execute it
in code, like this:


Dim varResult As Variant
Dim strSQL As String

strSQL = "UPDATE MyTable SET SomeField = " & varResult

CurrentDb.Execute strSQL, dbFailOnError

Note that the above assumes that varResult holds a numeric value.

I'm assuming that this calculated value may later be changed on a
record-by-record basis. Otherwise there's no point in saving it at all;
or at least, not in each record of this table.
 
Back
Top