Hi All,
I have an Access database that I want to distribute to a couple of end users. I want to create a connection that doesn't require I setup a DSN on their machines. They have access to the DB2 database.
Below is some code that connects using a Pass-Through query however it uses a DSN
I have setup DSN-Less connections to SQL Server using the below:
Using this approach I can just hand off the database to end users and as long as they have access to the SQL Server db they are good I don't have to setup DSNs etc...
Any help if greatly appreciated.
I have an Access database that I want to distribute to a couple of end users. I want to create a connection that doesn't require I setup a DSN on their machines. They have access to the DB2 database.
Below is some code that connects using a Pass-Through query however it uses a DSN
Code:
Dim db As Database
Dim strLogin As Variant
Dim strPassword As Variant
strLogin = txtLogin
strPassword = txtPassword
On Error GoTo err_handler
Set db = CurrentDb
'Refresh the Pass-Thru query links based on User Name and Password entered into the Logon Form
db.QueryDefs("RevOpt_NSCs").Connect = "ODBC;DSN=HIXDB;UID=" & strLogin & ";PWD=" & strPassword & ";MODE=SHARE;DBALIAS=HIXDB;"
db.QueryDefs("RevOpt_SDCs").Connect = "ODBC;DSN=HIXDB;UID=" & strLogin & ";PWD=" & strPassword & ";MODE=SHARE;DBALIAS=HIXDB;"
MsgBox "Login Successful"
txtLogin = Null
txtPassword = Null
Exit Sub
err_handler:
MsgBox Err.Number & " " & Err.Description
Using this approach I can just hand off the database to end users and as long as they have access to the SQL Server db they are good I don't have to setup DSNs etc...
Code:
db.TableDefs("dbo_Chase_Anthem").Connect = "ODBC;DRIVER=SQL Server;SERVER=VA10PWVSQL353\SQL01,10001;Trusted_Connection=YES;DATABASE=CRA;"
db.TableDefs("dbo_Chase_Anthem").RefreshLink
Any help if greatly appreciated.