473,394 Members | 1,709 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Start Form Default Size then Expand With Command Button

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!

Oct 9 '06 #1
3 5302
ray
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.Caption = "Show >>" then
Me!cmdShow.Caption = "Hide <<"
Docmd.MoveSize 1500, 900, 9500, 5700
Else
Me!cmdShow.Caption = "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!
Oct 10 '06 #2
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_SHOW = "Show >>"
Const CMD_CAPTION_HIDE = "Hide <<"

If Me!cmdShow.Caption = CMD_CAPTION_SHOW then
Me!cmdShow.Caption = CMD_CAPTION_HIDE
Docmd.MoveSize 1500, 900, 9500, 5700
Else
Me!cmdShow.Caption = CMD_CAPTION_SHOW
DoCmd.MoveSize 1500, 900, 6060, 5700
End If

--

Terry Kreft
<ra*@aic.net.auwrote in message
news:11**********************@e3g2000cwe.googlegro ups.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.Caption = "Show >>" then
Me!cmdShow.Caption = "Hide <<"
Docmd.MoveSize 1500, 900, 9500, 5700
Else
Me!cmdShow.Caption = "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!

Oct 10 '06 #3
Code works great! Thank you both for your assistance!!

Oct 12 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Miki Tebeka | last post by:
Hello All, I have a frame that contains a panel and several buttons. I'd like to make one of the button the default button but self.SetDefaultItem(btn) or btn.SetFocus() don't work. The item in...
0
by: syed_saqib_ali | last post by:
Please take a look at and run the code snippet shown below. It creates a canvas with vertical & Horizontal scroll-bars. If you shrink the window to smaller than the area of the canvas, the...
10
by: Steve Benson | last post by:
Our regular programmer moved on. I'm almost clueless in Javascript/ASP and got the job of adapting existing code. In the page below, everything works until I added the function checkIt() to...
10
by: Doug O'Leary | last post by:
Hey, all. I have a perl script which generates the html listed below. I cleaned it up a bit since the perl CGI module creates some really ugly html code. I've looked at this thing 8 ways to...
0
by: syed_saqib_ali | last post by:
Below is a simple code snippet showing a Tkinter Window bearing a canvas and 2 connected scrollbars (Vertical & Horizontal). Works fine. When you shrink/resize the window the scrollbars adjust...
1
by: syed_saqib_ali | last post by:
Below is a simple code snippet showing a Tkinter Window bearing a canvas and 2 connected scrollbars (Vertical & Horizontal). Works fine. When you shrink/resize the window the scrollbars adjust...
4
by: Popoxinhxan | last post by:
I would like to develop the form which allow expanable similar to the window address book application. Which enable you to enter the keyword and press the search button then the main form expand...
5
by: taylorjonl | last post by:
I am completely baffled. I am writting a daemon application for my work to save me some time. The application works fine at my home but won't work right here at work. Basically I have a...
2
by: Parasyke | last post by:
Please help.... I have a form that I successfully add records to that I want to copy and turn into a form for editing records from that same table (It is imperitive that it be done this way, rather...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.