Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ODBC Issues while connecting to an Oracle DB

Posted on 2004-07-30
3
Medium Priority
?
208 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 2000 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

Industry Leaders: 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

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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses

963 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