Agent mMm
06-15-2009, 10:19 AM
For reasons too numerous to go into here, I am building an Excel front-end that feeds into an Access back-end database. National network with many front-end data collection points to feed into a single database file.
I have no problem with the connection and can succesfully insert a new record if I directly inserting values e.g.
objCommand.CommandText = "INSERT INTO tblHoldingArea" & "([Asset name])" & "VALUES ('Dave');"
However, what I need is for the VALUES to be taken from a specific range of cells on the worksheet. I tried the following line, which does pick up the data from the specified range, however a syntax error is thrown up.
objCommnad.CommandText = "INSERT INTO tblHoldingArea" & "([Asset name])" & VALUES ("& arange &");"
The syntax error is:
Syntax error (missing operator) in query expression 'Test Data'.
'Test Data' being the contents of the cell referenced by arange.
Grateful for thoughts on this. Many thanks.
I have no problem with the connection and can succesfully insert a new record if I directly inserting values e.g.
objCommand.CommandText = "INSERT INTO tblHoldingArea" & "([Asset name])" & "VALUES ('Dave');"
However, what I need is for the VALUES to be taken from a specific range of cells on the worksheet. I tried the following line, which does pick up the data from the specified range, however a syntax error is thrown up.
objCommnad.CommandText = "INSERT INTO tblHoldingArea" & "([Asset name])" & VALUES ("& arange &");"
The syntax error is:
Syntax error (missing operator) in query expression 'Test Data'.
'Test Data' being the contents of the cell referenced by arange.
Grateful for thoughts on this. Many thanks.