Ok up till now I've been able get around it, but now I can't. I don't understand connection strings for use with ADO. We have users that connect to a remote AS400 Server. We use an ODBC connection to it for access. When it first connects they have to type in a shared username and password. My problem in some instances I need to be able to send that username and password rather than allow them to type it in. In Excel I just recorded a macro that made the connection and I can manipulated it enough to get buy, but in Access I don't have that option.
I've tried various code found here and links to other code, but I simply can't guess enough to get it working. Also a lot of it is using code to connect to a normal database on another drive or network drive which will be great at some other time, but doesn't help me.
Examples:
Excels Connection string
Could someone help or point in the direction of help (a book or something)?
I've tried various code found here and links to other code, but I simply can't guess enough to get it working. Also a lot of it is using code to connect to a normal database on another drive or network drive which will be great at some other time, but doesn't help me.
Examples:
Code:
"Provider=IBMDA400;" & _
"Data source=myAS400;" & _
"User Id=myUsername;" & _
"Password=myPassword"
Code:
"Provider=IBMDA400.DataSource.1;" & _
"Data Source=AS400;" & _
"User ID=UserId;" & _
"Password=Password;" & _
"Persist Security Info=True;" & _
"Catalog Library List=Lib1,Lib2,Lib3"
Excels Connection string
Code:
With ActiveSheet.QueryTables.Add(Connection:="ODBC;DSN=(DSN Name here);", _
Destination:=Range("A1"))
.CommandText = strSQL 'sql string I want to send.
.Name = "Query from (Here again)"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.Refresh BackgroundQuery:=False
End With
Could someone help or point in the direction of help (a book or something)?