Solved

Problem in Set cn = New Connection

Posted on 2004-10-16
4
219 Views
Last Modified: 2010-05-02
Sorry I am just a beginner to vb and I am using vb 6 Enterprise edition.
When I do,

 Public cn As Connection
 Private Sub cmdLogin_Click()
 Set cn = New Connection

 So as soon as I type the word "New" in the above statement a list is appearing having word "Collection" but its not  having "Connection". But iam having a project done by my friend and when I checked the same it showed "Connection" in that pop up list. So what is the problem? Thanks.
0
Comment
Question by:gopikrish
  • 2
4 Comments
 
LVL 8

Accepted Solution

by:
ampapa earned 50 total points
ID: 12328473
You probably don't have a reference set to use DAO or ADO.

Check your friends references and compare them to yours and you'll probably see a difference in VB toolbar (Project | References)

You might also take a look at this link:

http://www.able-consulting.com/MDAC/ADO/Connection/OLEDB_Providers.htm
0
 
LVL 12

Expert Comment

by:pique_tech
ID: 12328526
In line with ampapa's suggestion above, I've found that code readability, especially 6 months after I last looked at it, is greatly improved by DIMming everything with the type library it comes from, i.e.,
Public cn As ADODB.Connection
...
Set cn = New ADODB.Connection

etc.

For what it's worth...
0
 

Author Comment

by:gopikrish
ID: 12328561
Wow thanks ampapa you are right :)
0
 
LVL 8

Expert Comment

by:ampapa
ID: 12328777
Glad I could help.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question