Move controls between sections on a form

gem1204

Registered User.
Local time
Today, 12:00
Joined
Oct 22, 2004
Messages
54
Using Access XP
I have a continuous form that shows the main fields in my table. In the page footer of the form I have a tab control that has 4 additional fields for each record. I want to give the user the option of “Show Details”. When the user clicks on “show details” I want to move the tab control with the additional fields to the detail row so the user can see them.

I know how to move controls with VBA by setting the Top and Left properties and how to expand the detail size, but how do I move controls from one section on the form to ano :( ther section on the form i.e. from the page footer to the detail section
 
"Me.ControlName.SetFocus" moves focus to control "ControlName." Moving focus to a control on a subform from a control on the parent form, requires focus to be first set to the subform, then the subform control; the reverse if also true.

Moving focus to a sub-subform requires similar code. Permutations can boggle one's mind.
 
Thanks....but I don't care about sub forms right now. me.Mycontrol is in page footer of the form. I want to move me.mycontrol to the detail section of the form.

I want to expand the details section of a continuous form if a user selects "show details” and show 2 lines for each records . In this additional line I will display 3 more fields for each form.
Right now I am storing the additional fields in the page footer of the form.. When the user selects “view details” I want to expand the height property of the detail section of a the form. I have 3 fields that I want to add if the user selects 'show details'. I could put the 3 fields in the detail section, set their height properties to some minuscule number so as to make them almost invisible and them make them invisible. This would keep the height of the detail line to show only one line. If the user clicks 'show details' I could double the height of the detail line and set the height of the controls to the height of the other text boxes. If the user didn't want to see the details then do the reverse and collapse everything.

Rather than do all of this, I got the bright idea of putting the additional fields on a tab control with no tabs in the detail section of the form. If the user selected view details then I would move the tab control to the detail section of the form. For no details, I would move the tab control back to the page footer of the form. I can set the height for the detail section of the form based on the number of lines I want to display for every record.

How do you move controls to different sections of the form?
 
Last edited:
Sorry, I misread you original post.

Cut, past, and reposition a control to move it to another section. When pasted, it will always be against the left border. Just drag & alogn it where you want.

some but not all controls can be selected drug to a different section.
 
I want to move the controls with VBA

Here’s what I want to do. I have a continuous form that shows customer orders. The continuous form by default will only show one line for each record. On that 1 line show customer name, order date, and other information related to the order – One line per record. I also have a comments field and several other fields for each order. Sometimes the user needs to see the comments and additional fields for all records - either for editing or just viewing. I want to give the user the option of viewing the comments along with the data that is already showing. If he clicks on “show details” then I expand the details section and expand the height of the additional text boxes so he can view them. I have already done this. I put the 3 fields on an additional line in the detail section, set their height properties to some minuscule number so as to make them almost invisible and then set their visibility property to no. This would keep the height of the detail line to show only one line. If the user clicks 'show details' I increase the height of the detail line and set the height and visibility of the controls so they would show on the second line of the details section. Now the user sees 2 lines for each record. If the user doesn’t want to see the details then do the reverse and collapse everything.

Rather than do all of this, I got the bright idea of putting the additional fields on a tab control with no tabs in the page footer section of the form. If the user selected view details then I just would move the tab control to the detail section of the form. For no details, I would move the tab control back to the page footer of the form. I can set the height for the detail section of the form based on the number of lines I want to display for every record.

My one and only question is how do you move a control from one section of a form to another section of the form i.e. Move a tab control form the page footer of a form to the details section

Right now my tab control is the page footer of the form and the height is 0. If the user wants to view details I want to set the height of the tab control to be 0.2083. Right now if I change the height to 0.2083 it will be 0.2083 in the page footer of the form. I want to change the height to 0.2083 and move it to the detail section of the form.
 
In response to


My one and only question is how do you move a control from one section of a form to another section of the form i.e. Move a tab control form the page footer of a form to the details section

I don't know.

However, what I do is to hide/display & change controlsource, position & height of controls as required. You may have trouble collapsing a tab. If the code is not adequately commented, it can be difficult to decipher at a later date.

Maybe designing different subforms and then dynamically changing them as required would be easier initially and later for modifications. Put all you VBA is public modular.

I've found elegant code to be disasterous long after implementation when it's modified. KISS (Keep it simple stupid) is always a good rule, absent absolute necessity.

You might repost only the above quote to get a better response.
 
I agree with the KISS philosophy, but sometimes you can't do what you want with KISS. I've attached a database to this post to show you what I want to do. If you get a chance take a look at it. Sometimes a picture is worth a thousand words - this database is the same. It's an XP database. Please take a look and see if you can help some more
 

Attachments

Users who are viewing this thread

Back
Top Bottom