p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Beginning Access 2003 VBA (http://p2p.wrox.com/forumdisplay.php?f=150)
-   -   Chapter 4 clsCar (http://p2p.wrox.com/showthread.php?t=43825)

DavidG June 11th, 2006 09:48 PM

Chapter 4 clsCar
 
I'm getting an error when I run the form designed in Ch.4, I downloaded the book's code and ran the form and no errors. I have checked the code 1/2 dozen times and I can't see it.
The error says "The expression OnLoad you entered as the event property setting produced the following error: Cannot handle events for the object specified.
The expression may not result in the name of a macro, the name of a user-defined function, or [Event Procedure]. There may have been an error evaluating the function, event, or macro."
I've checked my code and it is exactly as written in the book. Is there a reference I'm missing. I'm stumped.

DavidG

DavidG June 15th, 2006 09:08 AM

I'm posting a reply to my own problem because I found what was wrong. I had accidently put the same line of code in the standard module AND the class module. This resulted in a confused program which then raised the error

DavidG

magicman July 14th, 2006 04:57 AM

What was this line of code as I am getting the same error on form opening. - cheers!


DavidG July 14th, 2006 05:11 AM

Quote:

quote:Originally posted by magicman
 What was this line of code as I am getting the same error on form opening. - cheers!


Dim WithEvents objCar As clsCar
I had duplicated this in the clsModule as well as in the form itself.
That line of code needs to go into the form's module.

DavidG


All times are GMT -4. The time now is 02:52 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.