Size Access Application on Open

J

Joe Coulter

Hi

Can anyone please help me with this one.

I want to size and place the Access application window when a user open a
database I have created, also I would like to hide the database window that
contains the forms, tables and queries etc.

Any help woul be gratefully appreciated


Thanks in advance


Joe
 
D

Dirk Goldgar

Joe Coulter said:
I want to size and place the Access application window when a user open a
database I have created, also I would like to hide the database window
that
contains the forms, tables and queries etc.


Hiding the database window is easily done via a startup setting: Tools ->
Startup..., uncheck "Display Database Window".

Sizing the Access application window can be done via calls to the Window
API, but Nicole Calinoiu has written a very nice class module to manipulate
form windows, which can also be used to manipulate the application window.
The code can be downloaded here:

http://www.mvps.org/access/forms/frm0042.htm
Forms: Move and Resize form windows from code

With that class module in your database, you could manipulate the
application window like this:

Dim fw As New clFormWindow

fw.hWnd = Application.hWndAccessApp

With fw
.Height = 900
.Width = 1200
.Top = 60
.Left = 50
End With

The numbers above are just for example.
 
J

Joe Coulter

Hi Dirk

Thanks for your reply, however I dont fully understand how to work it, I
have done the following:-

Created a new Module called clFormWindow containing the Code from the Nicole
Calinoiu link you suggested, where I am at a loss is wher to place the code
you suggest:-
Dim fw As New clFormWindow

fw.hWnd = Application.hWndAccessApp

With fw
.Height = 900
.Width = 1200
.Top = 60
.Left = 50
End With

Sorry for any inconvience, I am not fully code literate and would appreciate
soem assistance.

Thanks again

Joe
 
D

Dirk Goldgar

Joe Coulter said:
Thanks for your reply, however I dont fully understand how to work it, I
have done the following:-

Created a new Module called clFormWindow containing the Code from the
Nicole
Calinoiu link you suggested,

Be sure that you save this as a class module, not just a standard module.
where I am at a loss is wher to place the code
you suggest:-
Dim fw As New clFormWindow

fw.hWnd = Application.hWndAccessApp

With fw
.Height = 900
.Width = 1200
.Top = 60
.Left = 50
End With

Note that the values I gave there for the various properties are just for
example. You didn't say exactly what you want to do with the application
window, just that you want to manipulate its size and position.

You need to put that code into a procedure that will be run at startup. If
you have a startup form, you could put it into an event procedure for the
form's Open event. That way, at startup Access will open the form, and the
form's Open event procedure will run to execute the code.

If you don't have a startup form, and don't want to create one, then you
could put the code into a function in a standard module, and use an AutoExec
macro to run it (using the RunCode action). But a startup form is easiest
by far.
Sorry for any inconvience, I am not fully code literate and would
appreciate
soem assistance.

I'm happy to help you, but you'll have to let me know what areas give you
difficulty.
 
J

Joe Coulter

Thanks for you reply, It worked a treat, the problem was as you identified, I
had created a Module, Not a Class Module, when I rectified this, you fix
worked perfectly.

Thanks to Nicole Calinoiu

Again Dirk, thanks for your reply and also you patience

Regards

Joe
 

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