T
tp
Greetings,
The following code is what I planned to use in order to
update an Oracle table from an Access table.
However, I am having problems in my code recognizing both
databases in my sql statement. Code works fine as long as
I hard code the values to update. When I try to use Access
table doesn't work.
Sub Get_All_Users_Usage()
'**********************************************************
**************
'* Function RUN_OVERNIGHT ASSIGNMENT PROCESS
'* Created by Mike Perrou Winter 2004
'*
'* THIS MODULE IS FOR NIGHTLY REMEDY UPDATES FOR ACCT
ASSIGN.
'* This runs update query with pass-through user id and
password.
'*
'*
'* Select Remember password when linking out to ODBC
Driver fails when
'* modifications are made to Oracle table. Asks for you to
login again.
'**********************************************************
******************
' Declare Statements for ADODB Connections and Command
Dim cnn As ADODB.Connection
Dim cnn1 As ADODB.Connection
Dim cmd1 As ADODB.Command
Set cnn = CurrentProject.Connection
Set cnn1 = New ADODB.Connection
' Set Provider, ConnectionString, Passwords, and Open
With cnn1
.Provider = "MSDAORA"
.ConnectionString = "data
source=remedy.dnt.dialog.com;" & _
"intial catalog = remedy; " & _
"user id = xxxx;password=xxxx#;"
.Open
End With
' Set New Command
Set cmd1 = New ADODB.Command
' In Command Open both Current Project Connection and
Oracle Database table
' Command Text with Sql statement ment to update Oracle
table ARADMIN.T222 with local access table data
With cmd1
.ActiveConnection = cnn1
.ActiveConnection = cnn
.CommandText = "UPDATE ARADMIN.T222 " _
& "SET C4 = [2003 Account Assignments-AutoUp].
[admin].[Assignments].[Rep1-Login], " _
& "C536870986 = [2003 Account Assignments-
AutoUp].[admin].[Assignments].[Rep2-Login] " _
& "WHERE C536870988 IN(SELECT [2003 Account
Assignments-AutoUp].[admin].[Assignments].[Orig_User] FROM
[2003 Account Assignments-AutoUp].[admin].[Assignments]) "
_
& "AND C536870955 IN(SELECT [2003 Account
Assignments-AutoUp].[admin].[Assignments].[Source] FROM
[2003 Account Assignments-AutoUp].[admin].[Assignments])"
.CommandType = adCmdText
End With
' Execute Command cmd1
cmd1.Execute
End Sub
Would you be able to help with the right syntax
in order for this to work?
The following code is what I planned to use in order to
update an Oracle table from an Access table.
However, I am having problems in my code recognizing both
databases in my sql statement. Code works fine as long as
I hard code the values to update. When I try to use Access
table doesn't work.
Sub Get_All_Users_Usage()
'**********************************************************
**************
'* Function RUN_OVERNIGHT ASSIGNMENT PROCESS
'* Created by Mike Perrou Winter 2004
'*
'* THIS MODULE IS FOR NIGHTLY REMEDY UPDATES FOR ACCT
ASSIGN.
'* This runs update query with pass-through user id and
password.
'*
'*
'* Select Remember password when linking out to ODBC
Driver fails when
'* modifications are made to Oracle table. Asks for you to
login again.
'**********************************************************
******************
' Declare Statements for ADODB Connections and Command
Dim cnn As ADODB.Connection
Dim cnn1 As ADODB.Connection
Dim cmd1 As ADODB.Command
Set cnn = CurrentProject.Connection
Set cnn1 = New ADODB.Connection
' Set Provider, ConnectionString, Passwords, and Open
With cnn1
.Provider = "MSDAORA"
.ConnectionString = "data
source=remedy.dnt.dialog.com;" & _
"intial catalog = remedy; " & _
"user id = xxxx;password=xxxx#;"
.Open
End With
' Set New Command
Set cmd1 = New ADODB.Command
' In Command Open both Current Project Connection and
Oracle Database table
' Command Text with Sql statement ment to update Oracle
table ARADMIN.T222 with local access table data
With cmd1
.ActiveConnection = cnn1
.ActiveConnection = cnn
.CommandText = "UPDATE ARADMIN.T222 " _
& "SET C4 = [2003 Account Assignments-AutoUp].
[admin].[Assignments].[Rep1-Login], " _
& "C536870986 = [2003 Account Assignments-
AutoUp].[admin].[Assignments].[Rep2-Login] " _
& "WHERE C536870988 IN(SELECT [2003 Account
Assignments-AutoUp].[admin].[Assignments].[Orig_User] FROM
[2003 Account Assignments-AutoUp].[admin].[Assignments]) "
_
& "AND C536870955 IN(SELECT [2003 Account
Assignments-AutoUp].[admin].[Assignments].[Source] FROM
[2003 Account Assignments-AutoUp].[admin].[Assignments])"
.CommandType = adCmdText
End With
' Execute Command cmd1
cmd1.Execute
End Sub
Would you be able to help with the right syntax
in order for this to work?