To do this, you specify a "driver=" and "server=" parameter in your connect string as in the following example.
Note You must change Username= <username> and PWD =<strong password> to the correct values before you run this code. Make sure that Username has the appropriate permissions to perform this operation on the database.
cnstr = "driver={SQL Server};server=myserver;" & _
"database=mydb;Username=<username>;PWD=<strong password>;dsn=;"
Set cn = en.OpenConnection("", False, False, cnstr)
NOTE: The driver name must be surrounded by curly brackets. For example: "{SQL Server}."
(CAUTION: DSN-Less connections will not work in Visual Basic 4.0 16-bit. If you try to use them you will get a General Protection Fault in module ODBC.DLL at 0006:080F.)