473,804 Members | 3,809 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5330
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.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!
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_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!

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
5297
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 focus is a text control inside the panel. Any Ideas? (see short example below) Thanks.
0
2040
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 scroll-bars work as advertised. That's great. However, if you click the Left Mouse button, it calls code which expands the width of the canvas by 100 pixels. The area being viewed expands correspondingly..... BUT I DON'T WANT IT TO!!
10
3595
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 validate which radio button was clicked and what was in a textfield. The form is an attendance checking page for a cyber charter school. What I'm trying to accomplish is that if a parent marks the student present, there should not be anything in the...
10
2851
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 Sunday, but I can't see anything wrong. When I hit the "Add" button, it immediately executes the action of the form skipping the validate_form function completely. I've tried the script section towards the top of the html as well as just before...
0
3589
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 accordingly. However, what I really want to happen is that the area of the canvas that the scrollbars show (the Scrollregion) should expand as the window grows. It doesn't currently do this. although, if the window shrinks smaller than the...
1
12363
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 accordingly. However, what I really want to happen is that the area of the canvas that the scrollbars show (the Scrollregion) should expand as the window grows. It doesn't currently do this. although, if the window shrinks smaller than the original...
4
7896
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 including the dataset.COuld any one show me how to do this. Thank you
5
2223
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 MainForm what has a Start/Stop button that starts and stops the processing thread. private void StartButton_Click(object sender, System.EventArgs e) { if( bStopSignal ) { // disable controls that aren't valid when running
2
1903
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 than just one form) ... I need in the textbox for the new edit form to have the user type in a item# then the form populates. I'm having tremedous trouble with the logic of this. Thanks!!! Dav
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10569
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10325
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9140
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7615
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6847
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5519
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4295
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.