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!

Problem with Tab Control Pages on a form

Status
Not open for further replies.

Wrecker

Technical User
Aug 29, 2001
126
0
0
US
I have an Existing form with many Texboxes on it. I would like to put some Tab control Pages behind the existing Text Boxes. Then I can Tab to another Page and add some more Textboxes. The Problem is if I Put the Tab Pages on the form around the current textboxes, I can see the current textboxes no matter what tab page I select. If I Copy / Paste the Current textboxes to the selected Tab Page, I can only see the Textboxes when I'm on the selected Tab Page (Which is what I want} but I loose all the textbox names and the code that is associated with each one. How do I insert The Tab Pages behind the existing textboxes, and only hsve them show when that tab page is selected?

Hope this makes sence.....
Thanks
Wrecker
 
Hi

As far as I know the only method open to you is to eitehr follow the cut and paste route, and then name teh etxt boxes, and re-attach the code

Or to write code to cycle thru the forms controls collection effectively doing the same thing in code

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Maybe I'm confused by what you're asking but, have you tried right-clicking on the tab page you want to paste into and select paste from the menu that pops up? Depending on the amount of controls, the pasted items may show up at the bottom of the page...
If you do not have the entire tab page selected before pasting, your items will be pasted onto the form itself (probably behind the tab control) instead of being pasted into the tab control.
 
Assuming that the code you are losing are all [Event Procedure]s, and if your textboxes are being re-named when you paste into the tab control -- all the associated code is still there. All you have to do is re-name the textboxes back to their original name, and assign the respective event property back to [Event Procedure]

When a control is re-named (or deleted) the Access VB code still exists... At least this is the way it has behaved for me in Access 2002.

Earnie Eng
 
Not sure if this helps but...

I ran into that once and I had to delete the objects I pasted. Then I clicked the tab I wanted to paste into, and hit ctrl-v to paste. I noticed the key was to click the tab itself and nothing else, or it would paste onto the form as a whole, not the tab by itself.

Heck, try to cut what is there, and click the tab, then paste. Does that work?

I didnt have a problem with control names and events, so long as there werent other controls with the same name on the form.
 
I have seen this problem when trying to 'move' controls from the main part of a form, onto a tab control (e.g. when I started with a 'simple' form, then decided later that it would work better split onto tabs). In Access 2000 I find that I can cut and paste controls without losing the original control name and control source by doing this:

-- Click the control/s to be moved to select them (hold down the [Shift] key while clicking to select multiple controls)
-- Click the [Cut] button on the menu, or use [Ctrl]X on the keyboard, to cut the control/s to the clipboard
-- Click the required tab of the tab control to select it (you can tell it's selected when the square 'handles' appear on the control)
-- Click the [Paste] button on the menu, or use [Ctrl]V on the keybpoard, to paste the control/s onto the tab control.
-- Drag the pasted control/s to the required position/s.

It seems to be just a matter of taking care to select the tab control carefully before doing the paste operation. I hope that this helps.
 
BobStubbs's suggestion works in Access 2002, also.

I normally do this to associate a lable with a control (ever notice how you create a text field, access also inserts a label that persistently sticks with the control?)

by copy or cutting the label, then selecting the control I want it to be associated with, and pasting.

I guess this principle works with Tab Controls, too.

good luck!

Earnie Eng
 
Here is the solution step by step:

1) Select all the fields in question.

2) Right click in the middle of the tab control you want these fields to be on and choose Paste - Tip:You can also paste these field in the footer of the form to make sure you got all of the fields off the detail section and then paste them to the correct Tab Control.

3) Go to every fields that you have Event controls assoicated with them and click the three dots on the right side and it will associte all the code with that field - given your field names are the same in your Code.

4) You are done.

There are no short cuts to the above process it is the only solution that works - I know it is a pain to go to every field and re-assoicate the code with it - but I had to do it once for more than 20 fields one day - so I feel your pain.

Enjoy!
:)WB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top