>Run-Time Error Message '91' 
Author Message
 >Run-Time Error Message '91'

I create the following code to access a Oracle database

Dim Cnx As ADODB.Connection
Dim rs As ADODB.Recordset

Set Cnx = New ADODB.Connection
Cnx.Open "Provider=MSDAORA.1;PASSWORD=1;User
ID=callcenter:Data Source=banco", "callcenter", "1"

   ' Display the provider.
   MsgBox "Cnx provider: " & Cnx.Provider & vbCrLf
& "Conection OK"

when I run the project I have the following message:

Run-Time Error Message '91'
Objetct variable or With block variable not set

I dont understand what happened.

I need a help

thanks



Sat, 24 Jul 2004 02:39:17 GMT  
 >Run-Time Error Message '91'
Hi,

You misspelled in connection string. Replace : (after User
ID=callcenter) with ;

Cnx.Open "Provider=MSDAORA.1;PASSWORD=1;User
ID=callcenter;Data Source=banco", "callcenter", "1"

Val

Quote:
>-----Original Message-----

>I create the following code to access a Oracle database

>Dim Cnx As ADODB.Connection
>Dim rs As ADODB.Recordset

>Set Cnx = New ADODB.Connection
>Cnx.Open "Provider=MSDAORA.1;PASSWORD=1;User
>ID=callcenter:Data Source=banco", "callcenter", "1"

>   ' Display the provider.
>   MsgBox "Cnx provider: " & Cnx.Provider & vbCrLf
>& "Conection OK"

>when I run the project I have the following message:

>Run-Time Error Message '91'
>Objetct variable or With block variable not set

>I dont understand what happened.

>I need a help

>thanks

>.



Sat, 24 Jul 2004 02:53:34 GMT  
 >Run-Time Error Message '91'
HI
I think  connection object is not instantiated .
You can check like this:

Dim Cnx As ADODB.Connection
Dim rs As ADODB.Recordset

Set Cnx = New ADODB.Connection
If (Not (Cnx Is Nothing)) Then
        Cnx.Open "Provider=MSDAORA.1;PASSWORD=1;User "_
        & " ID=callcenter:Data Source=banco", "callcenter", "1"
else
        msgbox "error"
End If

You can aslo check like this
Msgbox isObject(Cnx)

Harinatha Reddy Gorla
        Software Engineer
Smart Software Technologies,
Hyderabad, India

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Sat, 24 Jul 2004 12:54:07 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. RUN TIME ERROR '91':

2. Run-time error '91' - HELP

3. run-time error '91'

4. Run Time Error '91'?

5. VB Run-time error '91'

6. Run-time error '91'

7. Runtime error '91'

8. Runtime error '91'

9. HELP : Error 91 : Run-Time Error 91 Object Variable or With

10. Error 91 running UpdateClass VBA macro from Sue Mosher's book

11. error '91'

12. Run-time error '-2147417846 (8001010a)': Automation error (error 440)

 

 
Powered by phpBB® Forum Software