Create DSN for AS400(iSeries) in Access on the fly

VegaLA

Registered User.
Local time
Today, 14:52
Joined
Jul 12, 2006
Messages
101
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....
 
Cheers for that Bob.

Mitch....
 

Users who are viewing this thread

Back
Top Bottom