replace

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
 
D

Dirk Goldgar

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.
 

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