VBA Code to size forms when opening

B

BWD

Hello group,

I have, what seems to me should be, a simple question but after much
research I can not find an answer that works.

I would like my Access 2003 forms to open at a certain height, width
and position on the screen. I have not been able to successfully
write an "On load" function that makes this consistently happen.

Code I have tried to fix the issue includes; "me.width = XX,
"me.detailheight = xx"

I know that you can resize the form in design mode and then select
save and the next time you open the form it will display those
dimensions. However, after awhile of using other forms shaped to
different sizes, the form I am trying to get a certain size re-opens
at different dimensions.

Does anyone know how to code forms to "always" open with the same
dimensions??

Many Thanks
 
B

BWD

find out info on:

DoCmd.MoveSize
[, down][, width][, height]

--
"Loose Change 2nd Edition" has been seen by almost 7 million people on
Google video



BWD said:
Hello group,
I have, what seems to me should be, a simple question but after much
research I can not find an answer that works.
I would like my Access 2003 forms to open at a certain height, width
and position on the screen. I have not been able to successfully
write an "On load" function that makes this consistently happen.
Code I have tried to fix the issue includes; "me.width = XX,
"me.detailheight = xx"
I know that you can resize the form in design mode and then select
save and the next time you open the form it will display those
dimensions. However, after awhile of using other forms shaped to
different sizes, the form I am trying to get a certain size re-opens
at different dimensions.
Does anyone know how to code forms to "always" open with the same
dimensions??
Many Thanks- Hide quoted text -

- Show quoted text -​


Thanks but every time I open a different form that is Maximized the
target form resets to maiximize as well. I tried also using the "Get
Focus" form event to remedy this as well but to no avail!

More thoughts?​
 
G

Guest

All forms are either "restored" or all are maximised. No pick and choosing.
You are better off restoring forms and then dragging them. The code can be
used with the "on load" event.

--
"Loose Change 2nd Edition" has been seen by almost 7 million people on
Google video


BWD said:
find out info on:

DoCmd.MoveSize
[, down][, width][, height]

--
"Loose Change 2nd Edition" has been seen by almost 7 million people on
Google video



BWD said:
Hello group,
I have, what seems to me should be, a simple question but after much
research I can not find an answer that works.
I would like my Access 2003 forms to open at a certain height, width
and position on the screen. I have not been able to successfully
write an "On load" function that makes this consistently happen.
Code I have tried to fix the issue includes; "me.width = XX,
"me.detailheight = xx"
I know that you can resize the form in design mode and then select
save and the next time you open the form it will display those
dimensions. However, after awhile of using other forms shaped to
different sizes, the form I am trying to get a certain size re-opens
at different dimensions.
Does anyone know how to code forms to "always" open with the same
dimensions??
Many Thanks- Hide quoted text -

- Show quoted text -​


Thanks but every time I open a different form that is Maximized the
target form resets to maiximize as well. I tried also using the "Get
Focus" form event to remedy this as well but to no avail!

More thoughts?
 
G

Guest

In addition to Restoring you size, you can also use the InsideHeight and
InsideWidth properties to size your form. I usually do this in the forms
Load event, but will occassionally use it when I want to give the user an
Advanced Options area.

DoCmd.Restore
Me.InsideHeight = 2 * 1440
Me.InsideWidth = 5 * 1440

HTH
Dale

--
Email address is not valid.
Please reply to newsgroup only.


BWD said:
find out info on:

DoCmd.MoveSize
[, down][, width][, height]

--
"Loose Change 2nd Edition" has been seen by almost 7 million people on
Google video



BWD said:
Hello group,
I have, what seems to me should be, a simple question but after much
research I can not find an answer that works.
I would like my Access 2003 forms to open at a certain height, width
and position on the screen. I have not been able to successfully
write an "On load" function that makes this consistently happen.
Code I have tried to fix the issue includes; "me.width = XX,
"me.detailheight = xx"
I know that you can resize the form in design mode and then select
save and the next time you open the form it will display those
dimensions. However, after awhile of using other forms shaped to
different sizes, the form I am trying to get a certain size re-opens
at different dimensions.
Does anyone know how to code forms to "always" open with the same
dimensions??
Many Thanks- Hide quoted text -

- Show quoted text -​


Thanks but every time I open a different form that is Maximized the
target form resets to maiximize as well. I tried also using the "Get
Focus" form event to remedy this as well but to no avail!

More thoughts?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top