Solved

VB6 - Compile Error - "Object does not source automation events"

Posted on 2006-11-21
1
2,935 Views
Last Modified: 2013-11-25
This is on a VB 6 project that I've had working for years and have added to from time to time.  Well, now, all of a sudden, I'm getting a compile error on a simple entry screen as follows:

(Partial code for screen follows)
-------------------------------------------------------------------
Dim WithEvents adoPrimaryRS As Recordset   <== ERROR HERE WITH "Object does not source automation events"
Dim mbChangedByCode As Boolean
Dim mvBookMark As Variant
Dim mbEditFlag As Boolean
Dim mbAddNewFlag As Boolean
Dim mbDataChanged As Boolean

Private Sub Form_Load()
    Dim db As Connection
    Set db = New Connection
    db.CursorLocation = adUseClient
    db.Open "PROVIDER=MSDASQL;dsn=SWSREParams;uid=;pwd=;database=BizParams.txt;"
   
    Set adoPrimaryRS = New Recordset
    adoPrimaryRS.Open "select DataBaseName,DSNName,ArchiveDBName,ActiveFileLocation,ArchivedFileLocation,DefaultName from BizParams.txt", db, adOpenStatic, adLockOptimistic
   
    Set txtDataBaseName.DataSource = adoPrimaryRS
    Set txtDSNName.DataSource = adoPrimaryRS
    Set txtArchiveDataBaseName.DataSource = adoPrimaryRS
    Set txtActiveFileLocation.DataSource = adoPrimaryRS
    Set txtArchivedFileLocation.DataSource = adoPrimaryRS
    Set txtDefaultName.DataSource = adoPrimaryRS
   
    mbDataChanged = False
End Sub
---------------------------------------------

I think this MAY be related to References and/or Components; but I cannot locate the problem.  AND, as far as I know, I've made no changes to them right before this started!  Anyway, ALL References and Components included -- in order listed inside the Project -- are:
______________________________________________________________

REFERENCES:
Visual Basic for Applications
Visual Basic runtime objects and procedures
Visual Basic objects and procedures
Crystal Report Viewer Control
Crystal Report 8 ActiveX Designer Run Time Library
Crystal Report 8 ActiveX Designer Design Time Library
Crystal ActiveX Query Viewer 1.0 Type Library
Crystal Report 8 Standard Wizard Library
Crystal Report Engine 8 Object Library
Crystal Report Export
Crystal Report Viewer Control
Crystal Reports 8 Library
Crystal Data Object
cryptext 1.0 Type Library
Microsoft Management Console 2.0
Microsoft Internet Controls
Microsoft Data Report Designer 6.0 (SP4)
Microsoft Data Source Interfaces
Microsoft DAO 3.6 Object Library
COM+ Services Type Library
Microsoft Data Formatting Object Library 6.0 (SP6)
Microsoft Data Binding Collection VB 6.0 (SP4)
OLE Automation
Microsoft OLE DB Simple Provider 1.5 Library
Microsoft OLE DB Service Component 1.0 Type Library
Microsoft ActiveX Data Objects 2.8 Library


COMPONENTS:
Crystal ActiveX Query Viewer 1.0 Type Library
Crystal Report Control
Crystal Report Viewer Control
Crystal Select Expert OLE Control Module
Microsoft ADO Data Control 6.0 (SP6) (OLEDB)
Microsoft Common Dialog Control 6.0 (SP6)
Microsoft DataGrid Control 6.0 (SP6) (OLEDB)
Microsoft DataList Controls 6.0 (SP6) (OLEDB)
Microsoft Internet Controls
Microsoft Masked Edit Control 6.0 (SP3)
Microsoft PictureClip Control 6.0 (SP3)
Microsoft Rich Textbox Control 6.0 (SP6)
Microsoft Tabbed Dialog Control 6.0 (SP6)
Microsoft Windows Common Controls 6.0 (SP6)
Microsft Windows Common Controls-2 6.0 (SP6)
____________________________________________

ANY help would be GREATLY appreciated and will get me off top dead center!  Thanks in advance for your help!

estewb

PS:  I forgot to note that even if I comment out the offending line on that entry screen, it occurs on other entry screens that are very similar in the Project!

0
Comment
Question by:estewb
1 Comment
 
LVL 4

Accepted Solution

by:
JRCSystems earned 125 total points
ID: 17992568
Heres the answer: Change the order/priority of the references.

You have BOTH DAO and ADO references, and according to your list, it references DAO first, which does not fire events.

If you are NOT using DAO, drop the reference.

If you are using both, be SURE to set the correct priority,

AND to be safe...

I would declare the variables as
Dim poRS    As DAO.Recordset
or
Dim poRS    As ADO.Recordset

etc
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

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

19 Experts available now in Live!

Get 1:1 Help Now