Discussion Locked

Acc97 Store ODBC connection

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have Oracle link tables that I can only provide data from if the ODBC connection information is entered. I want to store this connection information in my Access database code, so the users do not need it - but I can't find the proper place to store it. The table's 'connect' property is not helping me very much, so far.

Any help is appreciated.
Thanks.

3 replies

by michal.woznicki

If you have a full installation of Access you should get the option to store the connection string when you link the tables, but this is not always available.

Here is a simple reconnection routine for Linked Tables. It allows you to store the connection string in code and reconnect the linked tables on demand. Use a Macro to "RunCode" and browse to this function which should be stored in a Module.Function UpdConnectStr()

Dim Tdef As TableDef

For Each Tdef In CurrentDb.TableDefs
If Tdef.Connect <> "" Then

Tdef.Connect = "ODBC;DSN=;UID=;PWD=;"
End If

Next Tdef

End Function

Only the Linked Tbales are affected as only they have connection strings. Just replace the variables ;-)

by timfox

I haven't had time to implement this one the way that I want to (by calling anytime that the connection is required to be re-initiated/re-connected).
Thanks.

This discussion is closed to new replies.