Hi all,
I managed to find this nice code that creates a DSN for a SQL server table on the fly for when a user opens a form of the application I have created in Access 2007.
Dim stConnect As String
If Len(stUsername) = 0 Then
stConnect = "Description=SQLDSNName" & vbCr & "SERVER=MySQLServer" & vbCr & "DATABASE=MyDB" & vbCr & "Trusted_Connection=Yes"
Else
stConnect = "Description=SQLDSNName" & vbCr & "SERVER=MySQLServer" & vbCr & "DATABASE=MyDB" & stDatabase & vbCr
End If
DBEngine.RegisterDatabase "SQLDSNName", "SQL Server", True, stConnect
Which works perfectly, however there are other tables in the Application that also pull from a live AS400 table.
I tried editing the code above for the AS400 table but unfortunatly i've had no joy so I wonder if anyone knows of any code similar to above that would automatically create a ODBC DSN for a AS400 table?
I would prefer not to use a DSNless conenction.
Any help is greatly appreciated!
Thanks in advance,
Mitch....
I managed to find this nice code that creates a DSN for a SQL server table on the fly for when a user opens a form of the application I have created in Access 2007.
Dim stConnect As String
If Len(stUsername) = 0 Then
stConnect = "Description=SQLDSNName" & vbCr & "SERVER=MySQLServer" & vbCr & "DATABASE=MyDB" & vbCr & "Trusted_Connection=Yes"
Else
stConnect = "Description=SQLDSNName" & vbCr & "SERVER=MySQLServer" & vbCr & "DATABASE=MyDB" & stDatabase & vbCr
End If
DBEngine.RegisterDatabase "SQLDSNName", "SQL Server", True, stConnect
Which works perfectly, however there are other tables in the Application that also pull from a live AS400 table.
I tried editing the code above for the AS400 table but unfortunatly i've had no joy so I wonder if anyone knows of any code similar to above that would automatically create a ODBC DSN for a AS400 table?
I would prefer not to use a DSNless conenction.
Any help is greatly appreciated!
Thanks in advance,
Mitch....