Hi All you experts!
I've developed an Acc2003 App that reads from a ODBC linked table.
This link was created fro DBwindow->Link table. It often opens a window asking for userNmae and Pwd - I wold liek to aviod this wen distributing the App. So I wrote tis code:
I get Errror 2507: (traslation you are using an uninstalled ODBC driver.
I have ODBC installed, I use it!
Any help please?
I've developed an Acc2003 App that reads from a ODBC linked table.
This link was created fro DBwindow->Link table. It often opens a window asking for userNmae and Pwd - I wold liek to aviod this wen distributing the App. So I wrote tis code:
Code:
Public Sub linkOdbcTable(DataSource As String, UID As String, PWD As String, dbName As String, ParamArray Tables())
Dim dbs As Database
Dim tbl As Variant
Dim rst As DAO.Recordset
Dim linked As Boolean
Dim ConnectionString As String
linked = False
ConnectionString = "ODBC;DSN=" & DataSource & ";" & "DATABASE=" & dbName
If Len(UID) > 0 Then
ConnectionString = ConnectionString & ";" & "UID=" & UID & ";PWD=" & PWD
End If
ConnectionString = ConnectionString & ";"
For Each tbl In Tables
delTables "ODBC" & tbl 'Deletes Table if exists
'Create ODBC Connection:
DoCmd.TransferDatabase acLink, "ODBC Databases", ConnectionString, acTable, tbl, "ODBC" & tbl, False, True 'LANGUAGE=us_english;
If Not linked Then 'open a connection to speed the process:
Set rst = CurrentDb.OpenRecordset("ODBC" & tbl)
linked = True
End If
Next tbl
rst.Close
End Sub
I have ODBC installed, I use it!
Any help please?