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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Having Trouble Getting Your Events to Work At All?

Troubleshooting

Having Trouble Getting Your Events to Work At All?

by  Sameal  Posted    (Edited  )
I have seen this several times and now I have also seen someone asking about it. It occurs when you have set up a form incorrectly at any step along the way. The reason for this also lies in the roots of programming. The error you will receive follows:

The expression On Load you entered as the event property setting produced the following error: Member already exists in an object module from which this object module derives. 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 funciton, event or macro.

Basically if you switch to the VBA code window and begin to add events to a form manually without using the properties window of a form you will quickly get the error above.

Even if you've been making the events correctly all the way to the form and on the last one you decide to do manually. You just ruined that form. I have yet figured out how to reverse this process, but it can easily be avoided by ALWAYS using the Events tab in the Control Properties in Design View.

The reason for this is because in most higher-level languages you must link controllers to all of your controls. Not only do you have to define the form, the controls, their events, but you also must define the controllers that fire those events. In Access the controller creation is done for you everytime you go into Properties -> Events and create an event. You'll notice that it adds the framework to the sub-routine into the code for you. If you try and skip this properties dialog and move straight to code, you will not have the important controller built for you and therefore nothing will be listening to that button.
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top