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
Solved

ADODB Reference

Posted on 2002-03-27
16
762 Views
Last Modified: 2012-08-14
Just after installing MS Visual Basic 6the following line generated by the VBApplication Wizard gives a "User defined type not defined" compile error.

>>>Private Sub datPrimaryRS_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)<<<<

So I must need to manually set a reference to some library to use ADODB.

Could somone help.

-Neil
0
Comment
Question by:neilhoman
  • 8
  • 3
  • 2
  • +3
16 Comments
 

Author Comment

by:neilhoman
ID: 6901397
Does anyone know the reference that I should select
?
0
 
LVL 51

Expert Comment

by:Ryan Chong
ID: 6901427
Hi neilhoman,

Try to add M$ ActiveX Data Object 2.1 (or 2.5) Library from Reference to see if problem remains.
0
 

Author Comment

by:neilhoman
ID: 6901487
Should I try using a different approach other thatn using the wizards.
I am connecting to an ODBC data source .... which connects to mysql.

0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:neilhoman
ID: 6901491
thx ryancys will try that now
0
 

Author Comment

by:neilhoman
ID: 6901507
it says "procedure declaration does not match description of the event or procedure having the same name
0
 

Author Comment

by:neilhoman
ID: 6901509
This is all wizard generated code.
0
 

Expert Comment

by:dboero
ID: 6901682
I had a problem like yours. When I use the app wizard.

Add a reference  ActiveX Data Object 2.1 (or 2.5)  and other to Microsoft ActiveX Data Objects Recordset 1.5 library.





0
 

Author Comment

by:neilhoman
ID: 6901691
I have already tried that
.... thanx anyway ...

im gonna try just adding every ADO reference and see what happens
0
 

Expert Comment

by:dboero
ID: 6901699
Have you installed a Service Packs?
0
 
LVL 51

Expert Comment

by:Ryan Chong
ID: 6901714
If it's not working, try download the MDAC from M$ website:

http://www.microsoft.com/Data/download.htm
0
 
LVL 1

Accepted Solution

by:
Madmarlin earned 100 total points
ID: 6901912
Just try setting  a variable to reference a recordset.
eg
Dim Rs As ADODB.Recordset

After 'ADODB.' if it doesnt bring up a recordset in the list of objects then you know the reference to the
ActiveX Data Object 2.1 library is at fault.

Alternativly dont use the wizard and manual code heres one of my simple examples.

Dim Rs As ADODB.Recordset
Dim Cn As ADODB.Connection

Set Cn = New ADODB.Connection
Set Rs = New ADODB.Recordset
     
Cn.Open "Provider=SQLOLEDB;Data Source=" & g_strServer & ";Initial Catalog=" & g_strDB & ";User Id=" & g_Uid & ";Password=" & g_UPwd & "; "
'Return all active sites
Rs.Open "Select * From tblSites where active = 1", Cn

...Do Stuff with the returned data....

Set Rs = nothing
Set CN  nothing


Obviously your connection string will be different so

cn.open "YOUR CONNECTION PROPERTIES HERE"

Good luck.
Madmarlin
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 6901978
Change it to this:

Private Sub datPrimaryRS_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error,
adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset20)

Manually in your code, also you will need to change any similar event raised by this control. The reason is that you have the older version of the control that is only compatible with ADO 2.0, as you have ADO 2.1 or higher installed (probably 2.6 by now if you have followed other advice here) there was a change in the recordset object's interface from 2.0 to 2.1. Whilst this is something that should never have happened without changing the name of the object it did and we have to work around it. The only other workaround is to install VB SP4 or higher so that the newer version of this control is available that handles this automatically.

The change in the interface for this object is not something that will affect operation in any way that you will notice so don't worry about it.
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 6902196
0
 

Expert Comment

by:dboero
ID: 6903696
with a service pack 3 and references to ActiveX Data Object 2.1 (or 2.5)   and  ActiveX Data Objects Recordset 1.5 library. works fine

0
 

Author Comment

by:neilhoman
ID: 6911241
Recreated the app using adodb code...
And this got rid of my problems.
Accepting this answer to award points for the useful code (I am a beginner) and it is a good starting point.

Thanx to all for the useful comments though...
Keep up the good work guys,
-Neil
0
 

Author Comment

by:neilhoman
ID: 6911594
What's going on ...

There is no subform tool in my toolbox.

I want to embed an existing wizard generated form into a tab control on another page but I cant find my subform tool... how do I add it to my toolbox.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Copy a row 12 64
How to make an ADE file by code? 11 94
Zip Folders Using Chilkat Routines 1 58
which modules are active in VB6 project? 6 41
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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.
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 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…

860 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