User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Visual Basic 4 / 5 / 6 section within the Software Development category of DaniWeb, a massive community of 430,124 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,332 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums
Views: 319 | Replies: 2
Reply
Join Date: Jun 2008
Posts: 4
Reputation: EddyLLC is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
EddyLLC EddyLLC is offline Offline
Newbie Poster

Ivalid Use of New Keyword error

  #1  
Jul 23rd, 2008
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
Last edited by Tekmaven : Jul 24th, 2008 at 2:03 am. Reason: Code tags
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2008
Location: Sivakasi, Tamilnadu, India
Posts: 460
Reputation: selvaganapathy is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 81
selvaganapathy's Avatar
selvaganapathy selvaganapathy is offline Offline
Posting Pro in Training

Re: Ivalid Use of New Keyword error

  #2  
Jul 23rd, 2008
Hi, I think no error here. I check it out. But try this

ADODB.Connection
'Instead of using
Connection

Also try ADODB.RecordSet
Last edited by selvaganapathy : Jul 23rd, 2008 at 1:41 pm.
KSG
Reply With Quote  
Join Date: Nov 2006
Posts: 712
Reputation: QVeen72 is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 97
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Master Poster

Re: Ivalid Use of New Keyword error

  #3  
Jul 24th, 2008
Hi,

Recordset also need to be decalred as New..

  1. Dim adoRecordset As New ADODB.Recordset

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


Regards
Veena
Last edited by QVeen72 : Jul 24th, 2008 at 2:49 am.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Visual Basic 4 / 5 / 6 Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the Visual Basic 4 / 5 / 6 Forum

All times are GMT -4. The time now is 3:24 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC