I am trying to create the structure of a SQL Server database in MS Access. This function results in the following error... Run-time error '3024': could not find the file 'c:\users\*****\Documents\dbo.mdb.
Can anyone help me?
Public Function importExternal(strDSN As String) As Boolean
Dim i As Integer
Dim retval As Variant
Dim ODBCdb As Database
Dim strConnection As String
Dim srcTable As String
Dim locTable As String
Dim tdf As TableDef
strConnection = "ODBC;DSN=" & Trim(strDSN)
Set ODBCdb = OpenDatabase("", False, False, strConnection)
DoCmd.SetWarnings False
For Each tdf In ODBCdb.TableDefs
If tdf.Name Like "dbo.*" Then
srcTable = tdf.Name
locTable = "dbo_" & Mid(tdf.Name, 5)
DoCmd.RunSQL "SELECT * INTO " & locTable & " FROM " & srcTable & " WHERE 2=1"
i = i + 1
retval = SysCmd(4, "Processing " & srcTable)
End If
Next
MsgBox i & " tables imported"
ODBCdb.Close
End Function