Controling form sizes (1 Viewer)

NewfieSarah

Registered User.
Local time
Today, 20:27
Joined
Feb 11, 2005
Messages
193
How can I control the size of my form. I would like some of my form with my program to open small, since they are small forms, and some large because they are the whole size of the forms. I hope I have explained this enough for someone to help.Thanks in advance.
 

ghudson

Registered User.
Local time
Today, 18:57
Joined
Jun 8, 2002
Messages
6,195
Searching the forum is a great way to discover and learn the answers to your Access programming questions.

Here is how I set [force] the size of my forms...
Code:
Private Sub Form_Open(Cancel As Integer)
On Error GoTo Err_Form_Open
    
    'just for testing
    MsgBox "InsideHeight = " & InsideHeight & vbCrLf & vbLf & "InsideWidth = " & InsideWidth
    
    InsideHeight = 5450 'twips is the unit of measurement
    InsideWidth = 7870
    
Exit_Form_Open:
    Exit Sub
    
Err_Form_Open:
    MsgBox Err.Number & " - " & Err.Description
    Resume Exit_Form_Open
    
End Sub
 

NewfieSarah

Registered User.
Local time
Today, 20:27
Joined
Feb 11, 2005
Messages
193
Thanks for the code, however I am not sure that is really what I am looking for. shouldnt there be a property or something to have the form open to actual size of something? Any ideas?
 

ghudson

Registered User.
Local time
Today, 18:57
Joined
Jun 8, 2002
Messages
6,195
What is actual size?

You can define and enforce that with the code I posted above.

Maximized forms do not look professional. [personal opinion]
 

NewfieSarah

Registered User.
Local time
Today, 20:27
Joined
Feb 11, 2005
Messages
193
yes However how am I suppose to know what the correct size is for each form, I could be here for hours trying to size 1 form correctly. I have like 10- 15 forms. I would like to have each form the correct size it is suppose to be, with the data that is saw on it. Thanks for the help
 

rahulgty

Registered User.
Local time
Today, 15:57
Joined
Aug 27, 2005
Messages
99
Not only you can fix form size, you can also fix the opening position of form by command. On Forms Laod or Open event use

DoCmd.MoveSize 2000, 2000, 2000, 2000

where 2000 is distance from right, 2000 is distance from Top 2000 is width of form and 2000 is height of form. You can put same dimensions for all of your forms.

rahulgty
 

ghudson

Registered User.
Local time
Today, 18:57
Joined
Jun 8, 2002
Messages
6,195
You need to determine the size you want your forms to load with. Not all forms will need the same size. You can set all of your forms to the exact same size but it might not look right if a form only has a few objects versus a form that has a lot of objects and requires more real estate.

Forcing the form to load in a particular spot will not have the desired result if the users have different screen resolutions. The forms Auto Center property should be set to YES.
 

Pauldohert

Something in here
Local time
Today, 15:57
Joined
Apr 6, 2004
Messages
2,101
You can set the form to popup, and set the form to resize.
 

NewfieSarah

Registered User.
Local time
Today, 20:27
Joined
Feb 11, 2005
Messages
193
yes I know this ghudson. That is what I would, like to do set the different form to different sizes. I have my Auto center set to Yes already, I just need to figure out how to size my forms, to particular sizes, mayone someone has an example (ziped) that they could share with the code, to show me the different sizes. I dont know about this "DoCmd.MoveSize 2000, 2000, 2000, 2000" I tryed it and it didnt work, gave me errors, so I dont know what to do..
What about what Pauldohert said:
"You can set the form to popup, and set the form to resize."
Can you elaberate?? all forms popup dependant on the action, but how do I resize?? Thanks
 

Pauldohert

Something in here
Local time
Today, 15:57
Joined
Apr 6, 2004
Messages
2,101
auto resize can be foundin the property sheet of the form, set it to true, the form should then open to fit the controls you have on it.

Don't know if thats what you want?
 

NewfieSarah

Registered User.
Local time
Today, 20:27
Joined
Feb 11, 2005
Messages
193
No sorry that is not what I want, but thank for the try. That property will resize the form for maxamized or not. if one form is max then they will all open as max. I would like different size forms. Thanks anways.
 
R

Rich

Guest
If you want different sized forms to be controlled then you're going to have to code every form or write a complicated function that might not be reliable anyway
 

NewfieSarah

Registered User.
Local time
Today, 20:27
Joined
Feb 11, 2005
Messages
193
well I guess that is what i will do if there is no property for it. I was just thinking that there might be one, that i didnt know about. Do you happen to know what that code might be??
 

supercharge

Registered User.
Local time
Today, 15:57
Joined
Jun 10, 2005
Messages
215
Form's AutoResize property

I think you're using the AutoReSize property inproperly. When set to true, the form will load to the size of your form's size. What form's size, you'd ask?

When you create a new form in Design View. You initially get a blank form, see attached. That gray box right under it says Detail will be your form's size. It's stretchable. When you set its AutoReSize property to Yes, when open, you'll get your form at that form's size. So...if you want your form to show up just enough (neither max nor min) to see all the controls on it, go into your form in Design view, drag the form's size out or in or to whatever size you want, just enought to show all the controls and save.

Is that what you want?
 

Attachments

  • NewFormDesign.JPG
    NewFormDesign.JPG
    15.8 KB · Views: 2,252

NewfieSarah

Registered User.
Local time
Today, 20:27
Joined
Feb 11, 2005
Messages
193
However I already have my forms created. so it didnt change a thing. the forms are still as they were. if I have it max, they all open in max, if I dont have it max just the way it opens they are find. But What about the people who use this want the forms max, but only certain one can be , the main form, A,B,X,Y, C but not ID, Inspection. Right???
 

ghudson

Registered User.
Local time
Today, 18:57
Joined
Jun 8, 2002
Messages
6,195
NewfieSarah said:
well I guess that is what i will do if there is no property for it. I was just thinking that there might be one, that i didnt know about. Do you happen to know what that code might be??
I posted the code you need in my first response above.

"You" need to determine the size that you want your forms to be displayed at. You are the programmer [designer]; so make the decision on how you want your application to look.

The MsgBox line in my code above will tell you the size of the form when it is loaded [which you should only use while testing]. Obviously you have not even attempted to use the code I posted above.
 

NewfieSarah

Registered User.
Local time
Today, 20:27
Joined
Feb 11, 2005
Messages
193
actually I did try the code that you gave me and I kept getting an error for the size, so I was looking for another way. Thanks for all the help
 

ghudson

Registered User.
Local time
Today, 18:57
Joined
Jun 8, 2002
Messages
6,195
You should be able to at least find out the size your form is currently loading at. Remember that the size number is in twips, not inches! Notice the below code has the "Inside" commands commented out so that the message box will only display the size your form is currently loading at.

Code:
Private Sub Form_Open(Cancel As Integer)
On Error GoTo Err_Form_Open
    
    'just for testing
    MsgBox "InsideHeight = " & InsideHeight & vbCrLf & vbLf & "InsideWidth = " & InsideWidth
    
'    InsideHeight = 5450 'twips is the unit of measurement
'    InsideWidth = 7870
    
Exit_Form_Open:
    Exit Sub
    
Err_Form_Open:
    MsgBox Err.Number & " - " & Err.Description
    Resume Exit_Form_Open
    
End Sub
 

Pauldohert

Something in here
Local time
Today, 15:57
Joined
Apr 6, 2004
Messages
2,101
I am not being funny but can someone explain what is trying to be acheived.

Maybe I could use it myself.
 

supercharge

Registered User.
Local time
Today, 15:57
Joined
Jun 10, 2005
Messages
215
Hi Pauldohert,

I'm guessing this is what she wants. Let's say that you have one main form with has buttons to open other forms. If you max out the main form, any other forms that are opened by the command buttons will be maximized also. What she wants is that even the main form is maximized, other forms would be open as their own set-size, neither max nor min. Some are set at max and some aren't.

Hope this helps.

NewfieSarah said:
The forms are still as they were. if I have it max, they all open in max, if I dont have it max just the way it opens they are find. But What about the people who use this want the forms max, but only certain one can be , the main form, A,B,X,Y, C but not ID, Inspection. Right???
 

Users who are viewing this thread

Top Bottom