Microsoft
Software
Hardware
Network
Question : ISAM error importing SQL table into Access 2003
I am trying to import SQL tables into my Access 2003 DB. I am using a macro to do this. When I run the macro, I get the error "Could not find installable ISAM" . From looking at previous ISAM questions, most were having problems in VB, not macros.
I am using the "TransferDatabase" action with type set to "ODBC Database", full path of DBF file. I have tried map drive and UNC naming.
What am I missing?
Do I need to build a Module? If so, some help on it would be appreciated. Iv'e never built one...
thank you...
Answer : ISAM error importing SQL table into Access 2003
After you have populated the table above with the correct information you can put these function in to actually do the link. Note that if you don't want to keep the username and password in the database we can code around it but it can be a pain.
--------------------------
----------
----------
----------
----------
----------
----
Public Function CreateODBCLinkedTables() As Boolean
'On Error GoTo CreateODBCLinkedTables_Err
Dim strTblName As String
Dim strConn As String
Dim DB As Database
Dim RS As Recordset
Dim tbl As TableDef
Set DB = CurrentDb
Set RS = DB.OpenRecordset("tblODBCD
ataSources
")
With RS
While Not .EOF
' --------------------------
----------
---------
' Link table
' --------------------------
----------
---------
strTblName = RS("LocalTableName")
strConn = "ODBC;"
strConn = strConn & "DSN=" & RS("DSN") & ";"
strConn = strConn & "APP=Microsoft Access;"
strConn = strConn & "DATABASE=" & RS("DatabaseName") & ";"
strConn = strConn & "UID=" & RS("UID") & ";"
strConn = strConn & "PWD=" & RS("PWD") & ";"
strConn = strConn & "TABLE=" & RS("ODBCTableName")
If (DoesTblExist(strTblName) = False) Then
Set tbl = DB.CreateTableDef(strTblNa
me, _
dbAttachSavePWD, RS("ODBCTableName"), _
strConn)
DB.TableDefs.Append tbl
Else
Set tbl = DB.TableDefs(strTblName)
tbl.Connect = strConn
tbl.RefreshLink
End If
RS.MoveNext
Wend
End With
CreateODBCLinkedTables = True
'MsgBox "Refreshed ODBC Data Sources", vbInformation
CreateODBCLinkedTables_End
:
Exit Function
CreateODBCLinkedTables_Err
:
MsgBox Err.Description, vbCritical, "MyApp"
Resume CreateODBCLinkedTables_End
End Function
--------------------------
----------
----------
----------
---------
'*************************
**********
**********
**********
********
'The DoesTblExist function validates the existence of a TableDef
'object in the current database. The result determines if an
'object should be appended or its Connect property refreshed.
'*************************
**********
**********
**********
********
Public Function DoesTblExist(strTblName As String) As Boolean
On Error Resume Next
Dim DB As Database, tbl As TableDef
Set DB = CurrentDb
Set tbl = DB.TableDefs(strTblName)
If Err.NUMBER = 3265 Then ' Item not found.
DoesTblExist = False
Exit Function
End If
DoesTblExist = True
End Function
Random Solutions
Windows Explorer Keeps shutting down and restarting (VISTA)
prevent taskkill and netstop command
Access: Embed Application Icon
Access reporting
Looking for a PDF application that allows me to create forms
MSSQLSERVER unhandled exception 80000003, Error: 17311, Severity: 16, State: 1, SQL 2005, Windows 2008
How do I return a datatable from a stored procedure?
Windows Server 2008 r2
Cannot open .xls file attachments in Outlook
Sorting a date column in dataview