Buttons Cut & Pasted, loses code??

DavidWRouse

Registered User.
Local time
Today, 09:43
Joined
Jul 24, 2003
Messages
42
I have 2 buttons that use code to open forms. (On Click)

When I cut and paste the buttons the On Click is Blank.

I find this annoying because I have a few buttons that I Want to paste into a Tab Control on the same form.

Why Why, Does anyone know why this is happening. Or how to Avoid it.
 
Of course the copied button's events will be blank - it's a different button. Why would you want to have two buttons on one form with the exact same code on their Click event?
 
I am cutting them, and pasting them to a tab control part of my form. So There will still be only one button.
 
Ah! Gotcha....dunno why.
 
My question is to check the form's class module to see if the code underneath the button stayed intact.

If so, you should be able to open the button's properties to the Event table, select the OnClick event, and select [Event Procedure] from the choices. That ought to relink to the code as long as the name didn't change either.

I recall studying something about this before but it is kinda hazy.

I think it has to do with the fact that Access is MOSTLY object-oriented, unlike some languages and environments that ARE object-oriented. Your loss of the event-code linkage might be an example of where the "mostly" rears its ugly head.
 
David, Doc, others reading thread:

Jus thought I would throw in my 2 cents and let you know that it is possible to cut a button/object with code intact and move to different location with the use of a FREE addin called mztools. It is available for free download here: http://www.mztools.com/index.htm

If you are a serious developer then I HIGHLY reccommend this addin as it will save you ALOT of time as it has for me. Some of the features include:

- Error Handler addin
- Cut/Paste buttons with code
- Document Code/modules with click of button
- Message box builder
- ADO connection string builder (nice :) )
- Review source code (this is my fav as it will look at your code and tell you which items in your code are not being used to help keep things clean)
-many, many more things included....!!!

Note* I do not work for nor do I know the developer of this add in and like I said the add-in is free although he does accept donations - I just wanted to let everyone on this forum know that this utility is available and really helps me in my day-to-day coding adventures...

HTH,
Kev
 

Users who are viewing this thread

Back
Top Bottom