How to have pop up form change size with Cmd But (not user)

D

doyle60

Is is possible to have a command button with code change the size and
shape of a pop up form? I'd rather the button do this than the user
because I want to keep the form simple, less scary. When the button
is hit, the form will grow and other controls will appear.

I'd rather keep this pop up simple and only when the button is hit,
more complex.

Thanks,

Matt
 
F

fredg

Is is possible to have a command button with code change the size and
shape of a pop up form? I'd rather the button do this than the user
because I want to keep the form simple, less scary. When the button
is hit, the form will grow and other controls will appear.

I'd rather keep this pop up simple and only when the button is hit,
more complex.

Thanks,

Matt

Open the form using something like:
DoCmd.OpenForm "FormName", , , , , , "2880,4320"

Code the Pop-up form's Load event:
If Not IsNull(Me.OpenArgs) then
DoCmd.MoveSize , , Mid(Me.OpenArgs,InStr(Me.OpenArgs,",")-1),
Left(Me.OpenArgs,InStr(Me.OpenArgs,",")-1)
End If

The above will size the form to a width of 3" and a height of 2".
Change the measurements to whatever values you wish.
Note: All measurements are in Twips, 1440 per inch.
Look up the MoveSize method in VBA help.

I have no idea what you mean by this:
"When the button is hit, the form will grow and other controls will
appear"
 
J

Jack Leach

From anywhere in your code, you should be able to use:

Forms![FormName].Width = <twips>
Forms![FormName].Section("Detail").Height = <twips>

There are 1440 twips per inch, so if you want to set the width to 4" and the
height to 2" you would use:

Forms![FormName].Width = (4 * 1440)
Forms![FormName].Section("Detail").Height = (2 * 1440)

If you do this from the form module, you can get rid of the Form![name] part
and use Me. instead:

Me.Width = 4 * 1440
Me.Section("Detail").Height = 2 * 1440


hth

--
Jack Leach
www.tristatemachine.com

"I haven't failed, I've found ten thousand ways that don't work."
-Thomas Edison (1847-1931)
 
D

doyle60

Thanks, Jack,
But that doesn't work for pop ups since the size is really set by the
user, or what the user had set it to last. When I use that method, I
only see the slides change. But the form does not resize.

Thanks, Fred,
Yes, that works. Thanks for the MoveSize heads up. I am not using
your code but the MoveSize is working well for me.

I'm putting the code on a button on the pop to resize. After the
resizing code, I'm putting code to make some invisible controls change
to visible.

Thanks again,


Matt
 
J

Jack Leach

Thanks, Jack,
But that doesn't work for pop ups since the size is really set by the
user, or what the user had set it to last. When I use that method, I
only see the slides change. But the form does not resize.

News to me. I'll keep that in mind in the future.

Thanks,

--
Jack Leach
www.tristatemachine.com

"I haven't failed, I've found ten thousand ways that don't work."
-Thomas Edison (1847-1931)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top