(VBA) SQl add a calculated field

sambrierley

Registered User.
Local time
Yesterday, 23:50
Joined
Apr 24, 2014
Messages
56
Hi all.

im defining the below string to be used in an execute command from Project to add a calculated field to a table.

Job Number is a variable (1086) and is the name of the table.
the error im getting is "Syntax error in field definition" and seems to be related to the Duration field (the one i am creating.)

any help would be grand thanks

Code:
AddDuration = "ALTER TABLE " & JobNumber & " ADD Duration AS ((Finish '-' Start)*2.66666666666667);"
 
IF you have the math inside the quotes (shown above) then it wont run, the math must be outside:
= "ALTER TABLE " & JobNumber & " ADD Duration AS " & (([Finish] & - [Start])*2.66666666666667)
 

Users who are viewing this thread

Back
Top Bottom