469,265 Members | 1,966 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,265 developers. It's quick & easy.

How to change the height of the 'detail' part of a form?

sueb
379 256MB
I know how to set this Property, but what I'm really asking is how I can set it to something smaller than it wants to be.

On a continuous subform, I have a set of fields (all at the bottom of the Detail section) that normally I want to be invisible. On the click of a button, I want to set all their Visible properties to True.

So when the fields are invisible, I'd like to set the height of the Detail section to exclude the "real estate" reserved for the invisible fields, and then, on the click of the button, reset the height at the same time that I set the visibility properties.

Can this be done?
Jun 30 '11 #1
39 11686
Rabbit
12,516 Expert Mod 8TB
You can if you first move all the controls out of that area. Then move them back before you make them visible.
Jun 30 '11 #2
sueb
379 256MB
Rabbit, move them where? Do you mean just to a part of the detail that will be visible? Or, maybe, to the footer and then into the detail?
Jun 30 '11 #3
Rabbit
12,516 Expert Mod 8TB
To a part that will be visible. Probably from whatever coordinate they're at to (0,0). You will, of course, have to keep track of their old coordinates so you can move them back when you need to.
Jun 30 '11 #4
sueb
379 256MB
So I thought that just setting the Top property would do it, but that did nothing. What Property do I set? And what are the units? inches?
Jun 30 '11 #5
sueb
379 256MB
Maybe I should mention that I'm really just trying to move a single Tab Control, but it looks like all the fields on all the tabs are sort of "stuck" and prevent the Tab Control from moving freely. Does that even make sense?

I am able to make everything invisible by just setting the Tab Control's visibility, so I thought that I could move the Tab Control and all the fields would come right along.
Jun 30 '11 #6
Rabbit
12,516 Expert Mod 8TB
You'll have to bring all the controls up, then bring the tab control up, and finally shorten the height of the tab control.
Jun 30 '11 #7
sueb
379 256MB
Wow, I really have to handle each control and label individually? And by "bring up", I'm assuming you are talking about setting the Visible and Top properties? I sort of need specific words.
Jun 30 '11 #8
Rabbit
12,516 Expert Mod 8TB
Yes, that's what I mean. You could, conceivably, store all this information in a table and just loop through it. That way, if you add, rename, or delete controls, you don't have to constantly rewrite your code. The table could store the name of the control, the original top, and the "hidden" top.
Jun 30 '11 #9
sueb
379 256MB
Since I've never done anything like this, I wonder if you'd be so kind as to post an example of what this would look like. Thanks!
Jun 30 '11 #10
Rabbit
12,516 Expert Mod 8TB
It looks like you figured this out in a different thread?
Jul 1 '11 #11
sueb
379 256MB
In that thread, someone posted the code to iterate, but I am very interested in your "table" idea, so maybe you could show me that?
Jul 1 '11 #12
sueb
379 256MB
And I still haven't figured out how to "move" the tab control and its contents, all in one piece, to, say, the FormFooter and back, so that I can change the height of the detail section.

Any help on that?
Jul 1 '11 #13
Rabbit
12,516 Expert Mod 8TB
In pseudocode, basically you would do this.
Expand|Select|Wrap|Line Numbers
  1. Dim x As Recordset
  2. Set x = DoCmd.OpenRecordset("Table Name")
  3.  
  4. Set top of tab control to 0
  5.  
  6. Do Until x.AtEndOfRecordset
  7.    Me.Controls(x!NameOfControl).Top = 0
  8.    x.MoveNext
  9. Loop
  10.  
  11. Set height of tab control to some small number
  12. Make tab control invisible
  13. Set height of detail section to what you want
You don't have to move them out of the detail section.
Jul 1 '11 #14
NeoPa
32,171 Expert Mod 16PB
Essentially Sue, the size of any section is always constrained to be at least large enogh to include all the items within it. For a form, the width is always as wide as the widest section and the height of any section is determined by the controls within that section.

Thus, if there are controls at the bottom, whether or not they are visible, the section will be high enough to encompass them all completely. This is true both for when designing the form via the interface, and for when making changes on the fly in the code.

Tab controls are something else again.
It's not uncommon for controls to be added, with the idea that they are added onto a page of a tab control, but in realitity to the section underneath. This is something to look out for when having trouble controlling tab controls.
Jul 2 '11 #15
Adam Tippelt
137 100+
One extra thing to note is any size or location properties that you try to change with VBA, such as the Top value, must be done using a measurement of "twips" as opposed to centimetres.

You can do a simple search for centimetre to twip converter to work these values out.

So if you wanted to change a control so it was only 5cm from top, the code would look something like this:

Expand|Select|Wrap|Line Numbers
  1. Me.myControl.Top = 2835
Hope that helps.

Adam.
Jul 4 '11 #16
NeoPa
32,171 Expert Mod 16PB
While we're on 'other points worth bringing up', I found out quite recently (a couple of years back at most) that you could actually change the current size of a form from code using its Move() method. I'd struggled manfully for ages to find a way to resize (as the Height and Width properties are both R/O). You can still only make the size one such that all controls fit completely within it, but nevertheless the concept is doable (even if the actual method to use is far from obvious).
Jul 5 '11 #17
sueb
379 256MB
I do understand about making sure all the controls are actually on their tab page. In fact, I know that even more surely precisely because when I try to move my tab control, and the contained controls won't move, the tab control's bottom stays exactly where it was.

Isn't there a way to move the entire tab control (and all its contents) at once? It would be great if someone could tell me how to move it to the footer, because the footer will allow me to turn it off (even if it contains controls), and then I could move the tab back to the detail section when I needed to; but all this would work only if the "contained" elements just rode along nicely.
Jul 5 '11 #18
Rabbit
12,516 Expert Mod 8TB
Moving a control from one section to another is a design only function. You would have to put the form into design mode, move it, put it back into view mode, and then move back to the record you were on.
Jul 5 '11 #19
sueb
379 256MB
Ah. I see. Okay, then, I guess what I need is advice about how to move the tab control that I have (which contains a boatload of controls), all in one piece so that it retains its size/shape. Once I can move it, I know I can make it inVisible, and then resize the Detail section appropriately.
Jul 5 '11 #20
Rabbit
12,516 Expert Mod 8TB
To do this, refer to post #14 for pseudocode. But in short, set the top of the tab control. Move all the controls in the tab control. Set the height of the tab control.
Jul 5 '11 #21
NeoPa
32,171 Expert Mod 16PB
Just a thought (so I'm not certain it will work) but would cutting (not copying) and pasting of the tab control work?
Jul 5 '11 #22
Rabbit
12,516 Expert Mod 8TB
That would have to be done in design mode wouldn't it?
Jul 6 '11 #23
NeoPa
32,171 Expert Mod 16PB
I'm not absolutely certain. That's certainly what I was suggesting, but such things are often supported in code too. I would have thought doing it in design mode made more sense anyway, whatever the capabilities of the code are.
Jul 6 '11 #24
sueb
379 256MB
Just so it's clear: I need to be able to make this change at the request of the user.
Jul 6 '11 #25
NeoPa
32,171 Expert Mod 16PB
SueB:
Just so it's clear:
I'm afraid that clarifies nothing for me Sue. What did you mean to indicate?
Jul 6 '11 #26
sueb
379 256MB
Maybe I don't know enough about when design mode is available to me, but I assumed that, once I deploy a front end, and the user is actively using it, design mode would not be available to that user. (at least, I would certainly hope that my users don't find themselves in design mode--they wouldn't have the faintest idea what to do!)
Jul 6 '11 #27
Rabbit
12,516 Expert Mod 8TB
If they have the full version of Access, and they are not using a runtime version of the database, they have access to design mode.

If the front end is stored locally on their drive as opposed to on a network location, it should not be a huge problem to use design mode if you want to.
Jul 6 '11 #28
sueb
379 256MB
Okay, I guess I really don't understand. Are you saying that design mode is something I can code right into the procedure for the users' button? If that's so, then I have absolutely no idea how to execute design commands from code.
Jul 6 '11 #29
Rabbit
12,516 Expert Mod 8TB
I think you can but I've never had to do it myself.
Jul 6 '11 #30
NeoPa
32,171 Expert Mod 16PB
Design Mode is generally available to designers (such as yourself) when designing the various forms and other objects in your database. However, opening an object in Design Mode can also be done using code. It's less common certainly, and comes with a few gotchas that you should be careful of, but the option is there.

Design changes may be made by code when the object (form) is open and in normal use, but such changes are session level. They only persist for the duration of the current session and would not effect another user who had the same object open at the same time. If the object is opened in Design Mode though, and changes are made then the object is saved, this new version becomes the object for future uses. It is very rarely a good idea to work that way, but the facility is available should you choose to (If you hadn't got it before, I certainly wouldn't recommend using this facility).

Sue, You said before :
Just so it's clear: I need to be able to make this change at the request of the user.
I'm still not clear what you meant by that. Did you possibly mean you wanted the user to be able to make such a request of you personally and you would design it into the database? That's what the wording implies.

If you want to design the database such that a user could choose to move the tab control and its contents to another section on the click of a button then that's something else again.

As I say, I'm still not sure.
Jul 6 '11 #31
sueb
379 256MB
NeoPa, what I need is the latter: in other words, I want to put a button on a form that displays an otherwise-invisible tab control.
Jul 6 '11 #32
NeoPa
32,171 Expert Mod 16PB
From that last comment the solution is easy. Unfortunately, I believe we've already been there and you weren't happy because you needed the tab control and its contents not even to be there as invisible on the form due to the constraints which that put on the size of the section it was contained within. As such, this only seems to leads us around the same circle again.

At one point you were attempting to move the tab control and all its contents into another section. How far did you get with that and was it ultimately helpful?
Jul 6 '11 #33
Mihail
759 512MB
Hi all !
Maybe my english is not enough to understand the problem. So sorry if my idea can't work.
Sueb, take a look to InsideHeight command (Me.InsideHeight = ....). I think that is the answer to your problem IF you use Overlaping Windows. For Tabbed Documents do not work.
Attached Files
File Type: zip Database1.zip (31.1 KB, 137 views)
Jul 7 '11 #34
sueb
379 256MB
Mihail, what version is that attachment? I have 2003, and it can't open it.
Jul 19 '11 #35
Mihail
759 512MB
Is 2007.

Look: Create 2 buttons (Command1 and Command2) then use the CLICK event for each one.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command1_Click()
  2.     Me.InsideHeight = Me.InsideHeight + 100
  3. End Sub
  4.  
  5. Private Sub Command2_Click()
  6.     Me.InsideHeight = Me.InsideHeight - 100
  7. End Sub
Do not forget: Overlapping windows for your forms.
Hope the code work in 2003. I can't test it in this version.
Jul 20 '11 #36
sueb
379 256MB
Mihail, also I don't know what Overlapping Windows is. Can you please explain?
Jul 20 '11 #37
Mihail
759 512MB
I try to explain using my poor English.

I do not know if "Overlapping Windows" exist in 2003 version.
If you open more forms (2, 3, 4 .... ) in the same time you can see as many windows as opened forms (as usual windows in Windows operating system) but using only the Access window area.

On the other hand you can set the form to be as large as the Access window. In this case you'll see only one form at a time. This is NOT "Overlapping Windows" (2007 say that is "Tabbed document").

Maybe someone else wish to explain better using a true English :)
Jul 20 '11 #38
Adam Tippelt
137 100+
Basically Microsoft has done for Access 2007 what browsers have done to internet pages - the windows now have tabs to allow the user to easily switch between opened forms within the same Access window, so multiple forms can be open and accessed at once.
Tabs can however be turned off in the database settings if you want to hide them from users.
Jul 20 '11 #39
sueb
379 256MB
I see. No, I don't think that 2003 has tabbed windows. What I've done with some of my forms and reports is to "free" them from the Access window area by making them pop-ups. That seems to work pretty well.
Jul 20 '11 #40

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by Kevin Myers | last post: by
3 posts views Thread by xbox | last post: by
4 posts views Thread by K.N.Ranjit | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.