473,396 Members | 2,089 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,396 software developers and data experts.

setting form width in access

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.
Nov 10 '07 #1
6 22541
missinglinq
3,532 Expert 2GB
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)>
Nov 10 '07 #2
ADezii
8,834 Expert 8TB
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.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Open(Cancel As Integer)
  2. Const conInchesToTwips = 1440   'enables you to specify dimensions in Inches
  3. Dim intRight As Integer, intDown As Integer, intWidth As Integer, intHeight As Integer
  4.  
  5. DoCmd.Restore
  6.  
  7. intRight = (3 * conInchesToTwips)
  8. intDown = 0
  9. intWidth = (5 * conInchesToTwips)
  10. intHeight = (5.5 * conInchesToTwips)
  11.  
  12. DoCmd.MoveSize intRight, intDown, intWidth, intHeight
  13. End Sub
  14.  
Nov 10 '07 #3
NeoPa
32,556 Expert Mod 16PB
Line #5 is the important one if you simply want the form to avoid being opened as maximised.
Nov 13 '07 #4
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.
Nov 13 '07 #5
ADezii
8,834 Expert 8TB
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!
Nov 14 '07 #6
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 :)
Nov 14 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

5
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...
16
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
2
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...
2
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...
2
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...
4
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,...
4
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...
4
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
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...
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
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,...
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
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
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...
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...
0
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,...

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.