2

我正在尝试将一个字段添加到一个字段中,然后仅将值插入 VBA 中的该特定字段。它抛出一个错误:错误 3061 - 参数太少

下面是使用的代码和查询。

Public Sub Yearanddate()
Dim strsql As String
Dim curnt_yearanddate As Variant
Dim curnt_year As Variant
Dim curnt_month As Variant
curnt_yearanddate = Date
Debug.Print curnt_yearanddate
curnt_year = Year(curnt_yearanddate)
curnt_month = month(curnt_yearanddate)


If (curnt_month = 5) Then
Debug.Print CreateCSField("tblmayscores", "ControlShipping") # this is working fine/creates field

strsql = "INSERT INTO tblmayscores(ControlShipping )SELECT Count([Control Shipping Summary Report].[Supplier DUNS Code]) AS [CountOfSupplier DUNS Code]FROM [Control Shipping Summary Report] INNER JOIN tblmayscores ON [Control Shipping Summary Report].[Supplier DUNS Code] = tblmayscores.[Supplier DUNS] WHERE ((([Control Shipping Summary Report].YearofProblemcaseNumber)= curnt_year) AND (([Control Shipping Summary Report].MonthofProblemcaseNumber)= curnt_month)) OR ((([Control Shipping Summary Report].YearofProblemcaseNumber)= curnt_year-1)) GROUP BY [Control Shipping Summary Report].[Supplier Location Code]"

CurrentDb.Execute strsql
End If

Debug.Print month(curnt_yearanddate)
End Sub
4

0 回答 0