RegisterDatabase Example

This example registers a SQL server named "Clinton" and then opens the Pubs database (the default database) on that server.

Dim Att As String, MyDb As Database
Att = "Description = SQL Server on server Clinton" & Chr$(13)
Att = Att & "OemToAnsi=No" & Chr$(13)      ' Build keywords string.
Att = Att & "Network=DBNMP3" & Chr$(13)
Att = Att & "Address=\\CLINTON\PIPE\SQL\QUERY" & Chr$(13)
Att = Att & "Database=Pubs"
' Update ODBC.INI.
RegisterDatabase "Clinton", "SQL Server", True, Att
...
Set MyDb = OpenDatabase("Clinton", False, False, "ODBC;")
...