0

The following Code is causing an error when I try to set the AdoConn = New Connection. I receive an "Invalid Use of New Keyword" error. Can I get some guidence as to why? Thanks.

Dim adoRecordset As Recordset
Private Sub Form_Load()
    Dim adoConn As Connection
    Set adoConn = New Connection
    
    Dim str As String
    Dim sqlName As String
        
    Me.Caption = "Company Database"
''    Set adoConn = Nothing
'Next three lines opens the Jones.mdb database.
    adoConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Jones.mdb;Persist Security Info=False"
    Set adoRecordset = New Recordset
    
    str = "select * from tblToDo"
    adoRecordset.Open str, adoConn, adOpenDynamic, adLockOptimistic
3
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by QVeen72
0

Hi, I think no error here. I check it out. But try this

ADODB.Connection
'Instead of using
Connection

Also try ADODB.RecordSet

0

Hi,

Recordset also need to be decalred as New..

Dim adoRecordset As New ADODB.Recordset

also give Full Path of the Database in connection string..


Regards
Veena

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.