VBA Code to resize main access window.

M

macroapa

Hi,

I have a database that has the startup options changed to open a
certain form.


What I would like is code that also controls the default size (and
hopefully position) of the main access window when the database is
opened. The user would still be able to re-size and re-position the
access window if wanted.


Is there the equivalent of autoopen/autostart in access and how can I
(at least) control the height and width of the main window?


Thanks for any pointers.


Steve.
 
M

MikeJohnB

Search VB Help on MoveSize you will get an explanation on the MoveSize Method
DoCmd.MoveSize Right, Down, Width, Height

Right Optional Variant. A numeric expression.
Down Optional Variant. A numeric expression.
Width Optional Variant. A numeric expression.
Height Optional Variant. A numeric expression.

Positions are in twips

Coded in the on open function of the form

DoCmd.MoveSize 1440, 2400, 100, 2000
 
D

Dirk Goldgar

macroapa said:
Hi,

I have a database that has the startup options changed to open a
certain form.

What I would like is code that also controls the default size (and
hopefully position) of the main access window when the database is
opened. The user would still be able to re-size and re-position the
access window if wanted.

Is there the equivalent of autoopen/autostart in access and how can I
(at least) control the height and width of the main window?

Thanks for any pointers.

Steve.


It's possible to manipulate the size and position of the Access application
window, but you have to be careful, because you don't know -- unless you
expend some additional effort -- what the user's monitor size and desktop
resolution are.

You can use the Nicole Calinoiu's clFormWindow class posted here:

http://www.mvps.org/access/forms/frm0042.htm

to manipulate the application window. For example, you can size the
application window to just fit around the form. Conversely, you can resize
the form to just fit in the current size of the application window, using
the code posted here:

http://www.mvps.org/access/api/api0022.htm

However, as interesting a challenge as this sort of thing is, I'm not sure
it's a good idea.
 
P

(PeteCresswell)

Per Dirk Goldgar:
However, as interesting a challenge as this sort of thing is, I'm not sure
it's a good idea.

I'm just resizing/moving child windows - not even touching the
application's window - and have managed to burn myself as of
late.

I try to make all my screens save their size/locations and then
re-size/position themselves accordingly next time they're opened.

Recently one of my clients got himself a two-monitor setup.

Back to the drawing boards on that one.... -)
 

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