Click to See Complete Forum and Search --> : ADODB Connection Error. any help please?


Wendy
April 5th, 2000, 03:09 PM
I have VB6PE and Access 97. I used VB's wizard to create my form for me. When I went to run the following code, it gave me an error: "Compile Error: Invalid Use of New keyword". Is this a glitch/bug? Am I missing a DLL/reference?

Dim sSQL As String
Dim dfwConn As ADODB.Connection
Dim i As Integer
Dim j As Integer
Dim m_iMaxCol As Integer

' set strings
sConnect = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;User ID=Admin;Data Source=H:\DTC\UnAffirm\unaffirm.mdb;Mode=Share Deny None;Extended Properties=';COUNTRY=0;CP=1252;LANGID=0x0409';Jet OLEDB:System database='';Jet OLEDB:Registry Path='';Jet OLEDB:Database Password='';Jet OLEDB:Global Partial Bulk Ops=2"
sSQL = "select Affirm,Rec_Type,AffirmNum from tblEquity Order by AffirmNum"

' open connection
Set dfwConn = New Connection
dfwConn.Open sConnect

The error highlights the Set dfwConn line. Thanks for any help.
Wendy


Wendy

Creamy pie
April 5th, 2000, 03:30 PM
try using
Set dfwConn = New ADODB.Connection

That should work

Wendy
April 5th, 2000, 03:47 PM
THANK YOU!!! That did it! It errored again on a New Recordset code line. I added the ADODB before it and it is good-to-go! Thanks so much. I think this is the first time anyone has responded to a question I've written on here. Appreciate it.


Wendy

swalsh19
April 5th, 2000, 07:07 PM
Make sure your referencing ADO Components in your program.

The line Set dfwConn = New Connection try
Set dfwConn = New ADODB.Connection

April 6th, 2000, 11:45 AM
Replace the code "Set dfwConn = New Connection" with Set dfwConn = New ADODB.Connection. Hope it will work.
Sym13