フィールドにフィールドを追加し、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