I'm trying to set the width of a form so that it's only about 3 inches wide on the screen, but it keeps maximizing itself. If the calling form is maximized it immediately goes to maximized. I'd like to set the size of the form in either VBA or in the properties window and have it stay that way whenever the form is called.
6 22541
I think that the only way you can do this, Jeff, is to either have your smaller form defined as a PopUp form, or use acDialog as the WindowMode argument of the OpenForm command (which sets PopUp and Modal properties to Yes) DoCmd.OpenForm stDocName, , , , , acDialog
Linq ;0)>
I'm trying to set the width of a form so that it's only about 3 inches wide on the screen, but it keeps maximizing itself. If the calling form is maximized it immediately goes to maximized. I'd like to set the size of the form in either VBA or in the properties window and have it stay that way whenever the form is called.
To overwrite any previously existing Window States, and precisely position a Form, place the following code in the Form's Open() Event. This code will move a Form 3 inches to the Right, make no Downward adjustment, set its Width to 3 inches, and its Height to 5.5 inches. -
Private Sub Form_Open(Cancel As Integer)
-
Const conInchesToTwips = 1440 'enables you to specify dimensions in Inches
-
Dim intRight As Integer, intDown As Integer, intWidth As Integer, intHeight As Integer
-
-
DoCmd.Restore
-
-
intRight = (3 * conInchesToTwips)
-
intDown = 0
-
intWidth = (5 * conInchesToTwips)
-
intHeight = (5.5 * conInchesToTwips)
-
-
DoCmd.MoveSize intRight, intDown, intWidth, intHeight
-
End Sub
-
NeoPa 32,556
Expert Mod 16PB
Line #5 is the important one if you simply want the form to avoid being opened as maximised.
Thanks everyone for the help. I used a hybrid of all the answers. I set the form to be a pop-up and used the code to adjust it's size and position.
Thanks everyone for the help. I used a hybrid of all the answers. I set the form to be a pop-up and used the code to adjust it's size and position.
Nice solution, the best of both worlds!
NeoPa 32,556
Expert Mod 16PB
The beauty of multiple answers and ideas being posted.
The OP can mix & match to get what they want :)
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Laura |
last post by:
Hello,
Newbie question: Does anyone know how to dynamically set the screen
width in an applet? I have an applet that creates a horizontal bar
menu on a webpage, and I would like the width to be...
|
by: TD |
last post by:
This is the code under a command button -
Dim ctl As Control
For Each ctl In Me.Controls
If ctl.BackColor <> RGB(255, 255, 255) Then
ctl.BackColor = RGB(255, 255, 255)
End If
Next ctl
|
by: Paresh Dhakan |
last post by:
Hi !
I am facing a wierd problem in setting the width of a form to 20.
Suppose I create two forms Form1 and Form2.
Form1 is the container, meaning
this.IsMdiContainer = true;
Form2 is...
|
by: Jacques Leclerc |
last post by:
What's the trick to dynamically setting the width of a textbox?
In the code behind page Page_Load function I'm trying to dynamically set the
width of a textbox.
TextBox1.Width = "75px"
I...
|
by: John Murray |
last post by:
I am a complete javascript newbie figuring out how to do what my team needs
as we go along.
I recently created a page with drop down menus that call up swf pages. The
problem is, I have more...
|
by: MLH |
last post by:
Setting form's Picture property to another file from within
VBA doesn't repaint the form with new bitmap - for instance...
Me.Picture = "c:\pics\MyNewPic.jpg"
I tried
Me.Repaint
afterward,...
|
by: David C |
last post by:
I am emailing a GridView and setting its Width property to 900 before
rendering and it works great. However, when the rendering is done, I want to
reset the Width back to 95% like it was. When I...
|
by: Kelly Warden |
last post by:
I want to create a form in Access to update my table automatically with the information selected from combo boxes, lists, comments, etc.
Also, I want to automate this w/ some VBA or SQL or...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
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...
|
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,...
|
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...
|
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
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: 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,...
| |