Just a minor critique of the code shown. If you are going to compare string
literals you are better off declaring consts. That way you are much less
likely to have a typo bug.
So the "better way" to write the code below would be:-
Const CMD_CAPTION_SHO W = "Show >>"
Const CMD_CAPTION_HID E = "Hide <<"
If Me!cmdShow.Capt ion = CMD_CAPTION_SHO W then
Me!cmdShow.Capt ion = CMD_CAPTION_HID E
Docmd.MoveSize 1500, 900, 9500, 5700
Else
Me!cmdShow.Capt ion = CMD_CAPTION_SHO W
DoCmd.MoveSize 1500, 900, 6060, 5700
End If
--
Terry Kreft
<ra*@aic.net.au wrote in message
news:11******** **************@ e3g2000cwe.goog legroups.com...
This works for me:
Put a command button on the form called cmdShow. Set its caption to
"Show >>"
In its OnClick event, put:
If Me!cmdShow.Capt ion = "Show >>" then
Me!cmdShow.Capt ion = "Hide <<"
Docmd.MoveSize 1500, 900, 9500, 5700
Else
Me!cmdShow.Capt ion = "Show >>"
DoCmd.MoveSize 1500, 900, 6060, 5700
End If
In this case, the Show button makes the form wider. You could change
the MoveSize parameters to make it longer instead if you prefer.
HTH,
Ray
afr0ninja wrote:
Hello! I'm currently working on a form that has several input fields
and a subform. What I'm trying to accomplish is that when I first open
the form I'd like to have the input fields displayed only. The fields
are about 3" wide. Then I'd like to have a command button that when
pushed it would expand the form to about 9" displaying the subform
along with the input fields. The command button could then be pressed
again to shrink the form back to it's origional 3" size.
I've tried hiding the subform (which leaves a huge blank spot on the
screen) and I've tried using me.windowwidth and me.width which give me
error on form load.
I'm pretty new to code still, so any suggestions or ideas would be
greatly appreciated. Thank you in advance!