Form Size

aussieolie

Australian
Local time
Today, 08:37
Joined
Apr 3, 2002
Messages
47
When I open my forms (mainly from the switchboard), they always maximise, however the forms are designed to a nice size and I have to resize them by clicking the restore button.
How can I disable them from maximisign them when opening (as the look crap otherwise) lol.
I want to stop them automatically resizing the window, I have autosize disabled.
Thanks Ya'll for your help,

Olie
 
Last edited:
Set the form properties 'border properties' field to 'thin'. This prevents the user from resizing the form. There are other form properties as well that can be set to prevent the user seeing the scroll bars, record selectors, and navigation buttons.

Also, you can set the 'min/max buttons' setting to 'none' and the 'control box' setting to 'no'. This prevents users from using either of these form buttons.
 
Last edited:
Thanks, But Its MS Access is causing this resize. There are no objects prompting this to happen. I JUST DONT WANT MY FORMS BEING MAXIMISED WHEN THEY ARE LOADED.

Thanks for your help,

Olie
 
Are your forms PopUp forms? If so the trick that I use to adjust the size of pop forms so that they stay the same size all of the time is this.

While you are in design view and have made all the changes required, in the upper right hand corner click on the (sorry can't remember what is called) button between the minimize and the close button, this will size down your window for that form, then resize the window to the size you would like it to be when it is displayed to the user. Once you have adjusted, SAVE it. Now maximize everything and open just that form, it should be displayed the size you adjusted it to. I usually set the AutoCenter to Yes.

Hope this makes sense.
 
Thanks man. I think the option is called 'Restore' anyway, my code was forcing these windows to maximise, so I just removed that and the problem has been solved.

Thanks bud!

Olie
 
I am able to size the subform. But when I maximize the Main Form, then when the sub form opens up, I gets maximized.
How do i stop from happening?
 
I remembered a sample shareware that I had seen from
Peter's Software (Look on the web). He originally
provided a database with a ton of Windows API routines.
This is something that I evolved from that.

Put the following in a module:
(They are each one line only)

Declare Function WM_apiGetParent Lib "user32" _
Alias "GetParent" (ByVal hndWindow As Long) As Long _

Declare Function WM_apiSetWindowPos Lib "user32" _
Alias "SetWindowPos" (ByVal hndAccessWindow As Long, _
ByVal hWndInsertAfter As Long, ByVal x As Long, _
ByVal y As Long, ByVal cx As Long, ByVal cy As Long, _
ByVal wFlags As Long) As Long

I put this on my main form.

Private Sub Form_Current()
'
' This is based on an old shareware sample from
' "Peter's Software"
'
Dim WM_SWP_NOZORDER As Integer
Dim WM_SWP_SHOWWINDOW As Integer

Dim hndWindow As Long
Dim hndAccessWindow As Long
Dim lngXLeft As Long
Dim lngYTop As Long
Dim lngWidth As Long
Dim lngHeight As Long

WM_SWP_NOZORDER = &H4
WM_SWP_SHOWWINDOW = &H40

lngXLeft = 700
lngYTop = 300
lngWidth = 800
lngHeight = 300


hndWindow = Screen.ActiveForm.hwnd
hndAccessWindow = hndWindow
'
' The Access window has no parent
'
While hndWindow <> 0
hndAccessWindow = hndWindow
hndWindow = WM_apiGetParent(hndWindow)
Wend


Call WM_apiSetWindowPos(hndAccessWindow, 0, lngXLeft, _
lngYTop, lngWidth, lngHeight, WM_SWP_NOZORDER Or _
WM_SWP_SHOWWINDOW)

End Sub

HTH,
Wayne
 
I just put the following code on the form - activate event
Docmd.Restore
Then when the form gets the focus it will resize.
 

Users who are viewing this thread

Back
Top Bottom