Solved

ODBC Issues while connecting to an Oracle DB

Posted on 2004-07-30
3
197 Views
Last Modified: 2012-05-05
I can't figure out why this is not working...  I am getting an invalid SQL Statement everytime I run it....  Thanks in advance...

----------------  CODE  ----------------

Sub MainRun()
    Dim conOracle As New Connection
    Dim recOracle As New Recordset
    Dim StrTable
    Dim ICCount, OCCount

    StrTable = "RPT_ADMIN"
   
    ' Opens a connection to the Database
    conOracle.Open "Driver={Microsoft ODBC for Oracle};Server=RPT2;Uid=RPT_User;Pwd=RPT;"
   
    ' Opens table from database
    recOracle.Open StrTable, conOracle
   
    ' Adds record for each rep to database
    With recOracle
        Do Until recOracle.EOF
            If !COLLECTION_ACTIVITY_CODE = "IC" Then
                ICCount = ICCount + 1
            ElseIf !COLLECTION_ACTIVITY_CODE = "OC" Then
                OCCount = OCCount + 1
            End If
        .MoveNext
        Loop
        ' Closes table and database connections '
        recOracle.Close: conOracle.Close
    End With
End Sub

---------------- BREAK ----------------
0
Comment
Question by:gideonn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 4

Accepted Solution

by:
hamood earned 500 total points
ID: 11681132
Hi try this
strTable should be select query on the table like

strTable ="select * from RPT_Admin"

for adding new record in the DB
recOracle.addnew
at the start of operation and when it is complete just update the dataset

recOracle.update

hamood

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question