S
scott
In my code I'm trying to "import" data from table2, which is an external
dBASE file into table1 which resides within Access.When I run my code,
Access doesn't recognize table1 because I've changed the connection for the
dBASE sql part.
How can I modify my code so Access knows that table1 resides within Access?
CODE **************
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim sPath As String, sFile As String, sSQL As String
Set cnn = New ADODB.Connection
Set rst = New ADODB.Recordset
path= "C:\data\mydatabases\"
sFile = "myDBASEfile.DBF"
sSQL = "INSERT INTO table1(myDate, myData1) " & _
"SELECT myDate, myData1 " & _
"FROM table2 " & _
"WHERE myDate NOT IN (SELECT myDate FROM table2)"
cnn.Open "Driver={Microsoft dBASE Driver (*.dbf)};" & _
"DriverID=277;" & _
"Dbq=" & sPath
rst.Open sSQL, cnn, , , adCmdText
dBASE file into table1 which resides within Access.When I run my code,
Access doesn't recognize table1 because I've changed the connection for the
dBASE sql part.
How can I modify my code so Access knows that table1 resides within Access?
CODE **************
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim sPath As String, sFile As String, sSQL As String
Set cnn = New ADODB.Connection
Set rst = New ADODB.Recordset
path= "C:\data\mydatabases\"
sFile = "myDBASEfile.DBF"
sSQL = "INSERT INTO table1(myDate, myData1) " & _
"SELECT myDate, myData1 " & _
"FROM table2 " & _
"WHERE myDate NOT IN (SELECT myDate FROM table2)"
cnn.Open "Driver={Microsoft dBASE Driver (*.dbf)};" & _
"DriverID=277;" & _
"Dbq=" & sPath
rst.Open sSQL, cnn, , , adCmdText