By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,711 Members | 2,144 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,711 IT Pros & Developers. It's quick & easy.

copying controls from a form to a tab control

P: n/a
I have copied approx 20 controls from a form to a tab control for
reasons of space.

i now cannot run code triggered by the events of these controls.

for example, the following will not trigger the message box when
changed:

Private Sub cboA_Change()
MsgBox "combo A changed"
End Sub

the controls are all disabled and are only enabled when the previous
control has a value set.

any ideas?

thanks

Winshent
Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Winshent,

Instead of copying and pasting, try cutting and pasting. If you copy and
then paste, the original controls stay on the form so when you paste the new
controls get new names and not the names you chose which means that even if
you then delete the original controls, the new controls will still have new
names and therefore no events associated with them.

Situation:
cboA gets copies and pasted.
Access changes the name to something like Combo294
You then delete cboA.
Your Module now has cboA_Change() but there is no control named cboA
Combo294 now exists, and looks the same, but has no events associated with.

Make sense?

--
Jeremy Shapiro
Asandia, Corp.
www.asandia.com
1.866.ASANDIA (272.6342)
"winshent" <vi*************@btinternet.com> wrote in message
news:c8**************************@posting.google.c om...
I have copied approx 20 controls from a form to a tab control for
reasons of space.

i now cannot run code triggered by the events of these controls.

for example, the following will not trigger the message box when
changed:

Private Sub cboA_Change()
MsgBox "combo A changed"
End Sub

the controls are all disabled and are only enabled when the previous
control has a value set.

any ideas?

thanks

Winshent

Nov 13 '05 #2

P: n/a
On Fri, 11 Jun 2004 15:20:28 -0400, "Jeremy B. Shapiro"
<je***************@asandia.com> wrote:
Winshent,

Instead of copying and pasting, try cutting and pasting. If you copy and
then paste, the original controls stay on the form so when you paste the new
controls get new names and not the names you chose which means that even if
you then delete the original controls, the new controls will still have new
names and therefore no events associated with them.

Situation:
cboA gets copies and pasted.
Access changes the name to something like Combo294
You then delete cboA.
Your Module now has cboA_Change() but there is no control named cboA
Combo294 now exists, and looks the same, but has no events associated with.

Make sense?


Also, if you have cut and paste the controls, there's a good chance
that those controls' events will no longer associated with the
controls, even if they are in the form's module. One quick I have
found to deal with this is within the module: ctrl-A (to highlight
everything), ctrl-X to cut, ctrl-V to paste. The cutting and pasting
of all the code will cause all the events to become re-associated with
their controls.

Chuck
Nov 13 '05 #3

P: n/a
Chuck Van Den Corput <NO*****************@sympatico.ca> wrote in message news:<g0********************************@4ax.com>. ..
On Fri, 11 Jun 2004 15:20:28 -0400, "Jeremy B. Shapiro"
<je***************@asandia.com> wrote:
Winshent,

Instead of copying and pasting, try cutting and pasting. If you copy and
then paste, the original controls stay on the form so when you paste the new
controls get new names and not the names you chose which means that even if
you then delete the original controls, the new controls will still have new
names and therefore no events associated with them.

Situation:
cboA gets copies and pasted.
Access changes the name to something like Combo294
You then delete cboA.
Your Module now has cboA_Change() but there is no control named cboA
Combo294 now exists, and looks the same, but has no events associated with.

Make sense?


Also, if you have cut and paste the controls, there's a good chance
that those controls' events will no longer associated with the
controls, even if they are in the form's module. One quick I have
found to deal with this is within the module: ctrl-A (to highlight
everything), ctrl-X to cut, ctrl-V to paste. The cutting and pasting
of all the code will cause all the events to become re-associated with
their controls.

Chuck


thanks..

I did actually cut and paste (not copy and paste as described
above-incorrect statement). So i couldn't understand why all the code
was no longer working... even though the control names hadn't changed.

chuck... with regards to selecting all>cutting>pasting all code in the
module.. I will save the module with empty code and then repaste it..
but if this doesnt work then what should i try? wont be able to work
on this til monday now.

thanks again
Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.