DAO to ADO

A

Andym

Hello,

We are currently moving from dao to ado. We are wondering how to reattach
SQL tables we have linked to an access database using ado instead of dao.
We have to relink because, the server which we attach too is determined by
the user.
This is the current code we are currently using and need changed.

Dim mydb As Database
Dim TmpTable As TableDef
Dim intCountRecs As Integer
Dim intCount As Integer

intCountRecs = mydb.TableDefs.Count
For intCount = 0 To mydb.TableDefs.Count - 1
Set TmpTable = mydb.TableDefs(intCount)
If Len(TmpTable.Connect) > 0 Then
If left(TmpTable.Connect, 4) = "ODBC" Then
TmpTable.Connect = "ODBC;DSN=SERVER"
TmpTable.RefreshLink
End If
End If
Next

Thanks in advance,

Andy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top