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

Command button not closing form, getting an on click error .....

Status
Not open for further replies.

ciskris

Programmer
Jun 22, 2001
13
0
0
US
I have 5 forms so far in my database and am currently working on a data entry form. The first four forms all have exit buttons that close the form and open a main menu. For some reason on my fifth form the exit button brings up an error when it is clicked:

The expression On Click you entered as the event property setting produced the following error: Event procedure declaration does not match description of event having the same name.

All my exit buttons have different names and do have the same code of docmd.close. Why does the fifth exit button not work when it is clicked?
 
Save the form, close it, and then reopen it. Then see if you still get the error. That happens all the time when designing forms . . . events just stop working......don't know why, but when you close and reopen the form, the problems goes away.

If you still have the problem after closing and reopening the form, check the name of the command button and the related event procedure to make sure they actually do match.

What is the name of your command button control? If you name it something strange (like including an underscore in the name of the control), Access will sometimes complain about that. _________
Rott Paws

...It's not a bug. It's an undocumented feature.
 
The button still does not work when I close the form and application and go back in. I do get the same error message also. The name of my command button is cmdCloseVisitEdit and the name of the procedure is cmdCloseVisitEdit_Click(). The only code in the procedure is cmd.Close "SiteVisitEditForm". I have never had this happen before so I am confused about what would keep the button from not working. Are there certain properties that you have marked as yes in order to have the buttons work?
 
try changing your code to "docmd.close" _________
Rott Paws

...It's not a bug. It's an undocumented feature.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top