Autosize subform

E

erick-flores

Hello all

I know this question has been asked million times, but I just can not
figure out the right correct way to do it. This is my scenario:
Form A (Single form) and Form B (Datasheet view).
Form B is a subform in Form A.

I want to be able to maximaze both Form A and B when I open Form A. Of
course right now its only maximizing Form A. Form B will not do
anything. I have changed the properties on the form but no luck. I
tried downloading an .mde, paste all the codes to my forms and no
luck. I do not know what to do, I REALLY need some help here.

The problem is managers have this big monitors and they want to be
able to look at the datasheet view (Form B) in a bigger size.

Any ideas of how to maximize a subform when the form opens???


Thanks in advance
 
W

Wayne-I-M

Hi

You should tell the managers that's not what a sub form does - of course you
can make it bigger (open the main form in design view and drag the sub form
to the size you want then save). But - a sub form is just that it's a "sub".
You really shouldn't maximise it over the whole screen (well you"could")
but then what would be the point - you would be better simply opening
(filtered) it as a new form After/SomeEvent on the other form.
 
E

erick-flores

Thanks for your reply. I perfectly understand what I mean but I don't
know how to implemented. In other words what kind of code do I need?
do you have some examples available so I can use then as a guide?

Thanks in advance
 
E

erick-flores

What about some code that determines the resolution of the monitor.
Based on the resolution open the form in a certain way (bigger or
smaller). I dont know if this can be done...or how difficult is to get
it to work. I am just thinking on some ideas.

I need to able to switch depending on the resolution because the same
database is used by different monitors.
 
R

Rick Brandt

erick-flores said:
What about some code that determines the resolution of the monitor.
Based on the resolution open the form in a certain way (bigger or
smaller). I dont know if this can be done...or how difficult is to get
it to work. I am just thinking on some ideas.

I need to able to switch depending on the resolution because the same
database is used by different monitors.

Actually you should not. People with larger monitors running higher resolutions
do no want to see the same program windows only larger. They want to see MORE
stuff at one time. If you make the changes that allow the subform to grow as
the main form is resized then people with higher res monitors will automatically
be able to see more records than those with lower res monitors because they will
be able to make the main form larger relative to font size.
 
R

Rick Brandt

erick-flores said:
Thanks for your reply. I perfectly understand what I mean but I don't
know how to implemented. In other words what kind of code do I need?
do you have some examples available so I can use then as a guide?

Thanks in advance

Simple example when making the form taller/shorter. Lets say the subform is
normally one inch (1440 twips) tall and the InsideHeight of the form is normally
4 inches (5760 twips) tall. That means the subform is a tall as the forms
InsideHeight - 4320 twips. So if I make the main form taller/shorter the resize
event would be similar to.

Me.SubformControlName.Height = Me.InsideHeight - 4320
 
E

erick-flores

Simple example when making the form taller/shorter. Lets say the subform is
normally one inch (1440 twips) tall and the InsideHeight of the form is normally
4 inches (5760 twips) tall. That means the subform is a tall as the forms
InsideHeight - 4320 twips. So if I make the main form taller/shorter the resize
event would be similar to.

Me.SubformControlName.Height = Me.InsideHeight - 4320

I can not get this to work. I must be doing something wrong. This is
what I am doing:

On Resize Event in my main form I tried: Forms![All-details].Height =
Me.InsideHeight - 4320
and nothing happend. I got an error saying: "can't find the form 'All-
details' referred to in..."

What do I need to do? remenber my subform is in Datasheet view.


Thanks in advance
 
E

erick-flores

Actually you should not. People with larger monitors running higher resolutions
do no want to see the same program windows only larger. They want to see MORE
stuff at one time.
Yes, you are right they want to see more data.
If you make the changes that allow the subform to grow as
the main form is resized then people with higher res monitors will automatically
be able to see more records than those with lower res monitors because they will
be able to make the main form larger relative to font size.
Yes this is what I want
 
R

Rick Brandt

erick-flores said:
Simple example when making the form taller/shorter. Lets say the
subform is normally one inch (1440 twips) tall and the InsideHeight
of the form is normally 4 inches (5760 twips) tall. That means the
subform is a tall as the forms InsideHeight - 4320 twips. So if I
make the main form taller/shorter the resize event would be similar
to.

Me.SubformControlName.Height = Me.InsideHeight - 4320

I can not get this to work. I must be doing something wrong. This is
what I am doing:

On Resize Event in my main form I tried: Forms![All-details].Height =
Me.InsideHeight - 4320
and nothing happend. I got an error saying: "can't find the form 'All-
details' referred to in..."

What do I need to do? remenber my subform is in Datasheet view.


Thanks in advance

Remember you are changing the size of a *control* on the main form, not the
size of the form shown inside the subform control. When that inner form is
in continuous or datasheet view its vertical size doesn't matter. It will
automatically show however many rows the height of the subform control will
allow.

Just use the syntax in my previous example substituting the name of your
subform control (which is not guaranteed to have the same name as the form
inside).
 
E

erick-flores

I finally got it to work, I was just using the wrong syntax

Thank you very much Rick

:)
 
Top