M
Mike
At the moment I use the following query:
INSERT INTO Table1 ( Field1, Field2)
SELECT Field1, Field2
FROM [Sheet$] IN 'C:\File.xls'[EXCEL 5.0;];
The above works fine. But I need the path to be taken from
a field on a form (e.g. from [Forms]![frmMyForm]!
[FilePath] )
What will be the syntax instead of " 'C:\File.xls' "?
I tried to create the sql statement dynamically by using
code in the form:
dim strSQL as string
strSQL = "INSERT INTO Table1 ( Field1, Field2) " & _
"SELECT Field1, Field2 " & _
"FROM [Sheet$] IN " & Me.FilePath
CurrentDB.Execute strSQL, dbFailOnError
But the debugger claims that there is a syntax error in
FROM statement.
INSERT INTO Table1 ( Field1, Field2)
SELECT Field1, Field2
FROM [Sheet$] IN 'C:\File.xls'[EXCEL 5.0;];
The above works fine. But I need the path to be taken from
a field on a form (e.g. from [Forms]![frmMyForm]!
[FilePath] )
What will be the syntax instead of " 'C:\File.xls' "?
I tried to create the sql statement dynamically by using
code in the form:
dim strSQL as string
strSQL = "INSERT INTO Table1 ( Field1, Field2) " & _
"SELECT Field1, Field2 " & _
"FROM [Sheet$] IN " & Me.FilePath
CurrentDB.Execute strSQL, dbFailOnError
But the debugger claims that there is a syntax error in
FROM statement.