Solved

Problem in Set cn = New Connection

Posted on 2004-10-16
4
215 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now