Solved

ODBC Issues while connecting to an Oracle DB

Posted on 2004-07-30
3
195 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
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

773 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