Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

type mismatch on new instance 1

Status
Not open for further replies.

Ferlin

Programmer
Jan 18, 2001
71
US
Hi all,

I have a class called clschart in the class is a public event called datachanged that I am trying to use in a form for my chart of accounts. In the form right after the option explicit is the line.

Private WithEvents chartofaccts as Clschart

in the form_load sub routine is the line.

Set chartofaccts = New Clschart

the above line gives me a type mismatch error when I run the program.

There is also a chartofaccts_datachanged() routine that loads up my textboxes on the form with the data.

The event is defined and raised in the class as follows.

Right after the option explicit is the line.

Public Event datachanged()

there is a Load_Datafields sub routine that loads my member variables from my database and has the line.

RaiseEvent datachanged

Any Help would be appreciated.

Thanks in advance.

Ferlin.
 
Is the class within the same project? (I'm wondering about the instancing) If this is a local class (not part of a .dll), then you're doing things properly. It might be that something has been corrupted even, so you could try copying things to a new form (or making the same call from a new form) and perhaps that will fix things?
 
Also, make sure you haven't accidentally defined something else called ClsChart in your project. Rick Sprague
 
If you have compiled the class separately then the error is probably happening inside the CLASS_INITIALIZE sub. Move the source code for the class back into your project, right click on the code and Toggle Stop on all errors.
 
More than likly, you have changed the interface somewhere or compiled without binary compatibilty. The different GUID on either the ClassID or the TypeLib ID is causing you app to be unable to create the object even though the ProgID has not changed. Make sure that all of your COM objects that you are referencing are properly registered. - Jeff Marler B-)
 
bobhilt, RickSpr, JohnYingling and jmarler

Thanks for your responses, turns out that what had happened was this. There was a reference to the ADO and DAO 3.5 both in the project references. I had taken an OLD project that was written a long time ago, and was adding classes to it. I removed ALL the references and redid them for only what was needed so there was no longer any conflicts. There was no longer any ADO controls in the project, so I believe the problem was in the references, because it went away after I cleaned them up.

Again Thanks.

Ferlin.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top