?
Solved

ODBC Issues while connecting to an Oracle DB

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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
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…
Suggested Courses

718 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