How do I retrieve data using a ODBC connection ?

I believe that my connection it s ok.
I try retrieve information from database but there is a error (ODBC called error).

parameter :

Dim wrkODBC As Workspace
Dim conBO As DAO.Connection
Dim dbNumeros As DataBase
Set wrkODBC = CreateWorkspace  ("VTM_Con", "VTM_Con", "", dbUseODBC)
'It s Ok
Set conBO = wrkODBC.OpenConnection  
dbDriverPrompt, , "ODBC;UID=VTM;PWD=VTM;DSN=VTM")
'It s Ok    
MsgBox conBO.Connect
MsgBox conBO.Name  
With wrkODBC
     ' Enumerate Properties collection of ODBCDirect
        ' workspace.
        Debug.Print "Properties of " & .Name
        On Error Resume Next

        For Each prpLoop In .Properties
            Debug.Print "    " & prpLoop.Name & " = " & prpLoop
            MsgBox ("    " & prpLoop.Name & " = " & prpLoop)
        Next prpLoop
        On Error GoTo 0
    End With
    Set rstTemp = conBO.OpenRecordset("select * from oas_company")
'ODBC called Error !!!!! ?????
    With rstTemp
        Do While .EOF
        MsgBox !CODE
    End With

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Could you explain further.

Just by having a quick look and excuse me if I am completley wrong but where you have

do while .eof

Shouldn't you have:

 do while not .EOF


okay, apart from james stillmans' observation you are using rstemp without a declaration if you want to use this as a recordset than you will have to declare it. ie dim rstemp as adodb.recordset.  mail back to let me know what data access object you are using and what version of VB.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.