I designed a query for appending rows to a table. The SQL view for the query looks like this:
INSERT INTO ComplienceLabelInfo ( ProductionLotID, [Best By Date] )
SELECT [forms]![Production Log (Elixirs)]![Product Lot ID] AS [Product Lot ID], [forms]![Production Log (Elixirs)]![Production Date]+90 AS [Best By Date];
I want to put it into the vba code so it happens automatically, so I tried this:
Dim strSQL2 As String
strSQL2 = "INSERT INTO ComplienceLabelInfo ( ProductionLotID, [Best By Date] ) " & _
"SELECT [forms]![Production Log (Elixirs)]![Product Lot ID] " & _
"AS [Product Lot ID], [forms]![Production Log (Elixirs)]![Production Date]+90 AS [Best By Date];"
CurrentDb.Execute strSQL2, dbFailOnError
I get the following error message:
"Too few parameters. Expected 2."
(The last line of the code is highlighted)
I don't know what parameters it's talking about.
INSERT INTO ComplienceLabelInfo ( ProductionLotID, [Best By Date] )
SELECT [forms]![Production Log (Elixirs)]![Product Lot ID] AS [Product Lot ID], [forms]![Production Log (Elixirs)]![Production Date]+90 AS [Best By Date];
I want to put it into the vba code so it happens automatically, so I tried this:
Dim strSQL2 As String
strSQL2 = "INSERT INTO ComplienceLabelInfo ( ProductionLotID, [Best By Date] ) " & _
"SELECT [forms]![Production Log (Elixirs)]![Product Lot ID] " & _
"AS [Product Lot ID], [forms]![Production Log (Elixirs)]![Production Date]+90 AS [Best By Date];"
CurrentDb.Execute strSQL2, dbFailOnError
I get the following error message:
"Too few parameters. Expected 2."
(The last line of the code is highlighted)
I don't know what parameters it's talking about.