When you design an application that uses an ODBC data source, you may not have all the information to establish a connection and authenticate a user. One way to get a user connected to an ODBC data source is to display a dialog box listing all registered ODBC data sources on the user’s system. You can prompt the user to choose an ODBC data source by supplying only "ODBC; "
for the connect argument of the OpenDatabase method.
The user can then choose the appropriate data source name from the dialog box and supply user name and password information, if applicable. Your application can store the user’s connection information in a string by assigning the database’s Connect property to a string variable. The following code illustrates this technique:
Dim dbs As Database, strConnect As String ' When this line runs, the user is prompted to choose ' an ODBC data source. Set dbs = OpenDatabase("", False, False, "ODBC;") ' The user's choice is stored in a string variable. strConnect = dbs.Connect