jiangzhou He
jiangzhou He

Reputation: 57

Using SQL statement to add a query to table

I am trying to add a query result to a table in MS Access 2010 by running a SQL statement, but I get a time-run error saying

Microsoft Access can not find the input table or query. make sure it exists and the name is spelled correctly.

This is my code, please help me to check where I am wrong.

Private Sub Command6_Click()

    Dim strSql As String
    strSql = "INSERT INTO test(ConsumedDate, FinishedProudct, ConsumedItem, ConsumptionQuantity, Unit), SELECT ProductDate, ProductCode, [Ingredient/Packaging material],Consumption, FROM FormulaQuery"
   CurrentDb.Execute (strSql)

End Sub

Another question, can I use a datasheet form as input source in such condition?

Thanks

Jiangzhou

Upvotes: 0

Views: 67

Answers (1)

Ciro Corvino
Ciro Corvino

Reputation: 2128

...,Consumption, FROM FormulaQuery"

there is some comma in plus ;)

Upvotes: 2

Related Questions