Update fields (1 Viewer)

New_to_this

New member
Local time
Today, 12:30
Joined
Nov 20, 2018
Messages
7
hi,

I need to update some columns called "ask1", "ask2","ask3" they need to be updated but a column called "ask Calc" and in ask1 need to be 1.25 x ask Calc value, ask2 needs to be 1.50 x calc value and ask3 2 x cal value
how do I do this?

thanks
 

Ranman256

Well-known member
Local time
Today, 15:30
Joined
Apr 9, 2015
Messages
4,339
You shouldn't put calculated fields in a table. Use a select query to make the calculation live.
 

Eugene-LS

Registered User.
Local time
Today, 22:30
Joined
Dec 7, 2018
Messages
481
hi,

I need to update some columns called "ask1", "ask2","ask3" they need to be updated but a column called "ask Calc" and in ask1 need to be 1.25 x ask Calc value, ask2 needs to be 1.50 x calc value and ask3 2 x cal value
how do I do this?

thanks
Code:
Public Sub Test01()
Dim s$
Dim sTableName$
    sTableName = "DataTest" ' Set your table name here
    
    s = "UPDATE " & sTableName & _
    " SET ask1 = [ask Calc]*1.25, " & _
    "ask2 = [ask Calc]*1.5, " & _
    "ask3 = [ask Calc]*2"
    
    CurrentDb.Execute s 'run update query
    
End Sub
 

Users who are viewing this thread

Top Bottom