I have 8 different DNSs that I need to connect thru Access VBA in turn, link three tables (same name in each DB), pull specific pieces of data from each one and go on to the next.
The names of the DNSs all start with the same thing and I've built an array of the suffixes.
I'm having problems writing the connection strings.
I know I have a problem in OpenDatabase. It pops up the dialog to go to DNS. I want to go directly there, link my tables, and keep going.
Alan
The names of the DNSs all start with the same thing and I've built an array of the suffixes.
I'm having problems writing the connection strings.
Code:
Sub GetPerveData()
Dim RS As Recordset
Dim db As Database
Dim dbLoc As Database
Dim WS As Workspace
Dim rsLOC As String
Dim strSQL As String
Set dbLoc = CurrentDb
strSQL = "SELECT tblLocations.Code FROM tblLocations ORDER BY Code;"
Set RS = dbLoc.OpenRecordset(strSQL, dbOpenDynaset)
RS.MoveFirst
Do Until RS.EOF
rsLOC = RS!Code
' Set WS = CreateWorkspace("", "Global", "", dbUseODBC)'not working
Set db = OpenDatabase("", , True, "ODBC;DSN=Global_" & rsLOC & "SERVERNAME=Aardvark;uid=Global;pwd='';")
DoCmd.TransferDatabase acLink, "Global_" & rsLOC, , "Job_Header"
RS.MoveNext
Loop
MsgBox "Got to here"
' db.Execute "{ call sp_InsertText}"
End Sub
Alan