Ms access - vba: Compilation error: expected: =

I have a routine below

Public Sub updateStagesTable(sName As String, percentageValue As Double) stageName = "'" & sName & "'" sSQL = "INSERT INTO StagesT ([Stage Name], [Stage Value In Percentage]) VALUES (" & stageName & "," & percentageValue & ");" DoCmd.SetWarnings False DoCmd.RunSQL sSQL End Sub 

and I call it from another routine as shown below

 economy = 3.53 updateStagesTable ("Economy", economy) 

But I get this compilation error

 Compile Error: expected: = 

I do not understand what I am doing wrong here. Please help.

+5
source share
2 answers
 updateStagesTable ("Economy", economy) 

it should be

 updateStagesTable "Economy", economy 

without parentheses

See related: Unexpected results from file_name

+14
source

I never liked this feature of VB, so I always use the alternative CALL syntax, in your case it will be:

 Call updateStagesTable("Economy", economy) 

allowing brackets that all other languages ​​expect

+8
source

All Articles