J
John G
Hi,
I am trying to append records from one database to another. The target
database is located in a subfolder of 'My Documents' in XP ('Documents' in
Vista). Is it possible to use a variable path to the target database in the
INSERT INTO statement? The following code results in an error stating "Could
not find the file:C:\Documents and Settings\username\My Documents\strDBPath".
Error number 3024.
Dim strDBPath As String
strDBPath = SpecFolder(CSIDL_PERSONAL) & "\myDataFolder\DATA.mdb"
Dim SQL As String
SQL = "INSERT INTO tblChronLog ( LogDate, Activity, Initials ) IN
'strDBPath'" & _
"SELECT tblChronLog.LogDate, tblChronLog.Activity,
tblChronLog.Initials, *" & _
"FROM [tblChronologicalLog];"
DoCmd.RunSQL SQL
It is not reading "strDBPath" correctly because it is looking for a file
named strDBPath.
Do I need to specify the exact path to the target database or is it a
problem with the quotes within the statement?
Any advice would be appreciated.
John G
I am trying to append records from one database to another. The target
database is located in a subfolder of 'My Documents' in XP ('Documents' in
Vista). Is it possible to use a variable path to the target database in the
INSERT INTO statement? The following code results in an error stating "Could
not find the file:C:\Documents and Settings\username\My Documents\strDBPath".
Error number 3024.
Dim strDBPath As String
strDBPath = SpecFolder(CSIDL_PERSONAL) & "\myDataFolder\DATA.mdb"
Dim SQL As String
SQL = "INSERT INTO tblChronLog ( LogDate, Activity, Initials ) IN
'strDBPath'" & _
"SELECT tblChronLog.LogDate, tblChronLog.Activity,
tblChronLog.Initials, *" & _
"FROM [tblChronologicalLog];"
DoCmd.RunSQL SQL
It is not reading "strDBPath" correctly because it is looking for a file
named strDBPath.
Do I need to specify the exact path to the target database or is it a
problem with the quotes within the statement?
Any advice would be appreciated.
John G