Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Problem in Set cn = New Connection

Posted on 2004-10-16
4
Medium Priority
?
222 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 8

Accepted Solution

by:
ampapa earned 200 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 does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
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…

721 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