MSAccess 2003 / XP / Oracle 9.2 backend
Before I get started explaining it will be helpful to see my code snipet:
-------------------------------------------
tablename = 1
On Error Resume Next
For tablename = 1 To 2
If tablename = 1 Then pdtable = "pdtable_10 1"
If tablename = 2 Then pdtable = "pdtable_11 1"
DoCmd.DeleteObj ect acTable, pdtable
Next tablename
cboSite.SetFocu s
strSite = cboSite.Text
txtUser.SetFocu s
strUser = txtUser.Text
txtPass.SetFocu s
strPass = txtPass.Text
tablename1 = 1
odbcstring = "ODBC;Driver={M icrosoft ODBC for Oracle};Server= " + strSite + ";UID=" + strUser + ";PWD=" + strPass + ""
On Error Resume Next
For tablename1 = 1 To 2
If tablename1 = 1 Then pdtable = "pdtable_10 1"
If tablename1 = 2 Then pdtable = "pdtable_11 1"
DoCmd.TransferD atabase acLink, "ODBC Database", odbcstring, _
acTable, pdtable, pdtable, 0, True
Next tablename1
------------------------------
(there are actually 11 tables that i am linking, i just cut it down for space)
I have 2 Projects:
Project1 & 2 Server: MYSERVER
Project1 UID = Ted
Project1 Pass = Williams
Project2 UID = John
Project2 Pass = Jones
-------------------------------
Problem: When I start the app for Project1 and there are no tables initailly linked, everything works fine. Then I switch to project 2 by supplying the UID and Pass and click on attach tables (which runs this code). The existing tables are deleted and the correct UID, Pass for Project2 are used. However, it links Project1 tables again. Any ideas?
Before I get started explaining it will be helpful to see my code snipet:
-------------------------------------------
tablename = 1
On Error Resume Next
For tablename = 1 To 2
If tablename = 1 Then pdtable = "pdtable_10 1"
If tablename = 2 Then pdtable = "pdtable_11 1"
DoCmd.DeleteObj ect acTable, pdtable
Next tablename
cboSite.SetFocu s
strSite = cboSite.Text
txtUser.SetFocu s
strUser = txtUser.Text
txtPass.SetFocu s
strPass = txtPass.Text
tablename1 = 1
odbcstring = "ODBC;Driver={M icrosoft ODBC for Oracle};Server= " + strSite + ";UID=" + strUser + ";PWD=" + strPass + ""
On Error Resume Next
For tablename1 = 1 To 2
If tablename1 = 1 Then pdtable = "pdtable_10 1"
If tablename1 = 2 Then pdtable = "pdtable_11 1"
DoCmd.TransferD atabase acLink, "ODBC Database", odbcstring, _
acTable, pdtable, pdtable, 0, True
Next tablename1
------------------------------
(there are actually 11 tables that i am linking, i just cut it down for space)
I have 2 Projects:
Project1 & 2 Server: MYSERVER
Project1 UID = Ted
Project1 Pass = Williams
Project2 UID = John
Project2 Pass = Jones
-------------------------------
Problem: When I start the app for Project1 and there are no tables initailly linked, everything works fine. Then I switch to project 2 by supplying the UID and Pass and click on attach tables (which runs this code). The existing tables are deleted and the correct UID, Pass for Project2 are used. However, it links Project1 tables again. Any ideas?
Comment