Solved

Problem in Set cn = New Connection

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

776 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