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

Moving controls from tab page to another & losing events 3

Status
Not open for further replies.

4321z

Programmer
Oct 21, 2003
45
GB
Hi,

I've got a form, which has a tab control on it. On one of the pages I had several text boxes and combo's which each had related code, I moved these from one page to another and for some reason their (text boxes and combo's ) associated code/ events do not run, the only way I’ve found around this is to copy the code for each then delete the event then select the event and paste the code back in. This seems ludicrous is there something that I’m missing?
 
how are ya 4321z . . . . .

Hmmmmmmmmmmmmmmmm . . . .

Just exactly how did you move them?

cal.gif
See Ya! . . . . . .
 
how are ya 4321z . . . . .

Hmmmmmmmmmmmmmm . . . .

Just exactly how did you move them?

cal.gif
See Ya! . . . . . .
 
I just cut and pasted them from one page to the other, then deleted the old page
 
4321z . . . . . .

To my knowledge, cut & paste does not carry the code. You'll have to copy, then transfer the code.

cal.gif
See Ya! . . . . . .
 
The pages are all part of the same tab control therefore the code is already there for the form, but when i move say a combo box from one page to another the event which the code is in for that combo does not run. It's as if the event is no longer recognised as the event for that particular combo even though the combo name has not been changed
 
Sometimes the control simply loses its link to its click event. After you move the control, go to properties, event tab, "On click" event and see if there is "[Event Procedure]" shown. If not, click on the "..." and it should go to the VBA window, to the event of that name. The code should still be there and the click event will be relinked and work.
HTH
JSouth

---------------------------------------
The customer may not always be right, but the customer is always the customer.
 
4321z . . . .

Since your cutting & pasting, remember a different name is assigned to the combobox (the code stays]. Make sure you assign the proper name back to the control. This is the name that apears in [blue]Properties - Other Tab -[/blue] [purple]Name[/purple].
[blue]Its the control name changing thats causing loss of event execution[/blue].

cal.gif
See Ya! . . . . . .
 
In my experience with Access 2002 I do not lose the control name when I cut and paste a control. Maybe this is different in other versions, or the behavior relies on a setting in Access.

---------------------------------------
The customer may not always be right, but the customer is always the customer.
 
How are ya NorthNone . . . . .

Yes, it certainly looks that way . . . But if you open the [blue]Properties Window[/blue], and select the [blue]Other Tab[/blue], you'll see the [blue]Name Property[/blue], which is the actual name used for the control. Do a cut/copy & paste and you'll see it change to the next highest numeric ID for the control type.

I use to get in trouble with this along time ago, and its the same problem [blue]4321z[/blue] is currently having.

Look to the [blue]name property[/blue] and watch it change when you paste!

cal.gif
See Ya! . . . . . .
 
AceMan, I agree that if you copy a control and paste it, Access will change the name. But if you copy it to the clipboard, DELETE IT, and then paste it, it will retain its original name. Access renames the control only if it finds the same name already in existence for that form. 4321Z was talking about moving controls around, so I thought this distinction might help.
HTH
NorthNone

---------------------------------------
The customer may not always be right, but the customer is always the customer.
 
NorthNone . . . . . . .

An OldMan has learned a new trick here! . . . . Thank you!

I've never had to do this for myself, and thru the years its only been for those who require it. but I checked it out . . . and your right!. Anyone who can bring knowledge to the AceMan automayically gets a star! ;-)

cal.gif
See Ya! . . . . . .
 
NorthNone . . . . . . .

An OldMan has learned a new trick here! . . . . Thank you!

I've never had to do this for myself, and thru the years its only been for those who require it. but I checked it out . . . and your right!. Anyone who can bring knowledge to the AceMan automatically gets a star! ;-)

cal.gif
See Ya! . . . . . .
 
Found an easy solution guy's all you have to do is copy the entire code for the form, delete it and then paste it back, works fine then
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top