ms access - vba:编译错误:expected:=

时间:2015-07-09 23:08:46

标签: vba access-vba

我有一个子程序,如下所示

Arg 0 is <-host:myServer>         
Arg 1 is <-from:xxx@myDomain>
Arg 2 is <-to:me@myDomain>        
Arg 3 is <-s:Kiva>                
Arg 4 is <Extract>                
Arg 5 is <-msg:Kiva_Extract>      
Arg 6 is <has>                    
Arg 7 is <been>                   
Arg 8 is <completed>              
Arg 9 is <for>                    
Arg 10 is <July.>                 

我从另一个子程序中调用它,如下所示

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

但是我得到了这个编译错误

economy = 3.53
updateStagesTable ("Economy", economy)

我不明白我在这里做错了什么。请帮忙。

2 个答案:

答案 0 :(得分:23)

updateStagesTable ("Economy", economy)

应该是

updateStagesTable "Economy", economy

没有括号

参见相关内容:Unexpected results from typename

答案 1 :(得分:14)

我从来不喜欢VB的这种特性所以我总是使用备用CALL语法,在你的情况下这将是:

Call updateStagesTable("Economy", economy)

允许所有其他语言所需的括号