How do I copy controls with code attached? (1 Viewer)

cawillwe

Registered User.
Local time
Today, 14:29
Joined
May 8, 2001
Messages
12
I'm looking to save a little time when I copy certain buttons from one database's form to another. These buttons have code attached, but when I copy, the code doesn't come with it. I have to go into the vb editor and copy the code, and then go back and set all the proper events back to "[Event Procedure]" Is there some quick way to copy a control as well as all the code that comes with it? Thanks.
 

Rich@ITTC

Registered User.
Local time
Today, 14:29
Joined
Jul 13, 2000
Messages
237
Hi cawillwe

As far as I know you are following the correct procedure ... disappointing, isn't it! The CBF code is a separate entity to the objects/controls on the form ... so it means copying the control/button/whatever, copying the code and then linking the two in the new form. If anyone knows an all inclusive way, I'd also love to hear about it!

HTH

Rich Gorvin
 

Atomic Shrimp

Humanoid lifeform
Local time
Today, 14:29
Joined
Jun 16, 2000
Messages
1,954
The only way that I know of achieving anything like this (which might be of use:

I often have to set up applications with a fair number of similar forms, for example, the design may dictate that (among other things) they all have a 'quit' button at the bottom right corner which closes the form.
So I create a blank generic form that contains all of the common aspects (and has properties such as DividingLines, ControlBox, Modal, PopUp etc set to whatever is desirable) - I then make multiple copies of the form and tailor each of the copies to a specific task.

I keep a 'library' of form templates like this in a separate database; they can be imported intact into another DB using the File/Get External Data/import option.

But I don't think there's any way of copying a control and it's code (or no easier way than the way you're doing it at that mo)
 

cawillwe

Registered User.
Local time
Today, 14:29
Joined
May 8, 2001
Messages
12
Thanks for the help guys. I'm trying to add things to existing forms, so a template wouldn't help in this case, but I'll keep it in mind for the future and I use one for searching already. Wouldn't it be great if you could do it simply though? Oh well.
 

Users who are viewing this thread

Top Bottom