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
ISA Vs Squid Proxy
In VFP how can you locate what windows users have use of a table or exclusive use of the table
Guides On Data Access Pages
How do I close Adobe Reader from within VB.NET
Error in Stored Proceedure Syntax
ADO.NET Insert Command
Error Loading sshnas.dll
Extract sender,subject,priority,at<wbr />tachment from ms outlook using vba
CRM 4.0: issues pre-populating a Currency lookup and money field ("A currency is required if a value exists in a money field")
How to get Full XML node name using C#