Solved

ODBC Issues while connecting to an Oracle DB

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
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…
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…

744 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now