Hi,
I am trying to combine two different sources of informations to one row in SQL:
1 source) Excel table (Headers from Routing Number to Expected UoM)
2 source) VBA code : Application.Username and VBA.Now (From Account Name to Creation Date) * - this part of VBA code is not yet finished so I am using VALUES ('TEST', 02/02/2023) as random data just to have something written.
At end, 2 source) will look like (but not important for topic):
Syntax part:
Error is:
Syntax error in FROM clause.
I've tested both SELECT * FROM and VALUES but separately and they work, but I don't know how to combine them into one query to update 1 row.
I am trying to combine two different sources of informations to one row in SQL:
1 source) Excel table (Headers from Routing Number to Expected UoM)
2 source) VBA code : Application.Username and VBA.Now (From Account Name to Creation Date) * - this part of VBA code is not yet finished so I am using VALUES ('TEST', 02/02/2023) as random data just to have something written.
At end, 2 source) will look like (but not important for topic):
Code:
VALUES(" & Application.Username & "," & VBA.Now & ")"
Syntax part:
Code:
"INSERT INTO db_workplans ([Routing Number],[Target Date],[Material/Asset],[Description],[Type],[Consumption],[UoM],[Expected UoM],[Account Name],[Creation Date]) SELECT * FROM [Excel 12.0;HDR=YES;IMEX=1;Database=" & "C:\Users\xxxxxx\Desktop\Book1.xlsb" & "].[Sheet1$A1:H5] AND VALUES ('TEST',02/02/2023) WHERE [Material] = 'TEST'"
Error is:
Syntax error in FROM clause.
I've tested both SELECT * FROM and VALUES but separately and they work, but I don't know how to combine them into one query to update 1 row.