CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2000
    Location
    St. Louis, MO
    Posts
    40

    ADODB Connection Error. any help please?

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

  2. #2
    Join Date
    Mar 2000
    Posts
    175

    Re: ADODB Connection Error. any help please?

    try using
    Set dfwConn = New ADODB.Connection

    That should work



  3. #3
    Join Date
    Apr 2000
    Location
    St. Louis, MO
    Posts
    40

    Re: ADODB Connection Error. any help please?

    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

  4. #4
    Join Date
    Nov 1999
    Posts
    31

    Re: ADODB Connection Error. any help please?

    Make sure your referencing ADO Components in your program.

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



  5. #5
    Guest

    Re: ADODB Connection Error. any help please?

    Replace the code "Set dfwConn = New Connection" with Set dfwConn = New ADODB.Connection. Hope it will work.
    Sym13




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured