Hide Access Application window?

N

NES

I have a simple application - one form only - and the Access menu bar and the
window that holds it is somewhat annoying. Is there any way to hide
(preferably temporarily) the Access window and menu bar when I call the
application in? I'm NOT speaking of the database window, but rather the title
bar and the gray screen that sits behind and around the application. It would
just look neater to see only the form without this area showing. I have it
reduced in size, but I can't eliminate it altogether. Is it possible to hide
it? Any help would be most appreciated. Thank you.
 
T

Tom van Stiphout

On Thu, 20 Nov 2008 04:32:01 -0800, NES

That is possible, but certainly not trivial. You have to use a Popup
form, and then use a bunch of Windows API calls to resize the main
Access window behind your form, and to keep it there when your form is
moved.

-Tom.
Microsoft Access MVP
 
N

NES

Oh wow. That sounds like a lot of fun --- NOT! I suspected it might not be
easy, and it's not really worth a lot of effort. But I sure thank you for the
information. I've often wondered about that. Thanks again.
 
D

Dirk Goldgar

Tom van Stiphout said:
On Thu, 20 Nov 2008 04:32:01 -0800, NES

That is possible, but certainly not trivial. You have to use a Popup
form, and then use a bunch of Windows API calls to resize the main
Access window behind your form, and to keep it there when your form is
moved.


It's not quite that hard, Tom -- you can hide the application window
completely with (I think) one API call. However, any form or report you
want to show on the screen has to be both popup and modal, so it's
definitely cumbersome to do for any but the simplest application. This link
has the code:

http://www.mvps.org/access/api/api0019.htm
API: Manipulate Access Window
 
N

NES

Dirk, thank you for that information and link. I've copied it for safe
keeping. I'm not sure exactly where this code should be placed I'm assuming
that selecting the On Open option from the form properties will allow me to
open the proper window.

If that is so, I'm going to give this a try. Thanks again.
 
D

Dirk Goldgar

NES said:
Dirk, thank you for that information and link. I've copied it for safe
keeping. I'm not sure exactly where this code should be placed I'm
assuming
that selecting the On Open option from the form properties will allow me
to
open the proper window.

If that is so, I'm going to give this a try. Thanks again.


The code from the web page should go into a new standard module, which you
would create by going to the Modules tab of the database window (if you're
using Access 2003 or earlier) and clicking the "New" button. If you're
using Access 2007, I don't remember exactly how you do it, but I think you
go to the Create tab of the ribbon, and drop down the Macro button to choose
Module -- or something like that. Once you're in the module, paste in the
code from the web page, and save the module.

The form's Open event is where you put the code to call that function. If
you set the form's On Open property to "[Event Procedure]", then click the
builder button (caption "...") at the end of the property line, you'll find
yourself in the VBA editor, positioned inside the Form_Open event procedure,
ready to add the code. It will look like this:

Private Sub Form_Open(Cancel As Integer)


End Sub

You'll add lines to make it look like this:

Private Sub Form_Open(Cancel As Integer)

Me.Visible = True
DoEvents
fSetAccessWindow SW_HIDE

End Sub

That's all the coding you need to do. The only other thing you need to do
is make sure your form's PopUp and Modal properties are both set to Yes.
 
D

Dirk Goldgar

Girl Seeking Access Help said:
Hi Dirk,
I followed the instructions above and it WORKED!!! The instructions were
great and easy to follow. It took it me a couple of minutes to figure out
PopUp and Modal were in the "other" tab, but other than that... it worked
like a charm!!
Thank you very much


You're welcome, Anna.
 
L

Larry Daugherty

The below snippet of code is taken from one of the "execute" command
buttons that causes a form to be either Previewed or Printed
immediately depending on the state of two radio buttons in an option
box that toggle each other. The sense of the line of code with the
DcCmd is:

print the report whose name is in local string variable DocName. If
the value of Me!optPrintOrPrieview = 1 then print the report
immediately, else just display it for preview. There is (or used to
be) complete information in Access Help including useful examples.



Dim DocName As String

DocName = "rptLineCountSortedbyDate"
DoCmd.OpenReport DocName, IIf(Me![optPrintOrPreview] = 1,
A_NORMAL, A_PREVIEW)



HTH
 
D

Douglas J. Steele

You may have fallen victim of word-wrap

The line beginning DoCmd.OpenReport is supposed to be the same line as the
line ending A_PREVIEW)

Another way of writing it that should avoid the word-wrap issue is

DoCmd.OpenReport DocName, _
IIf(Me![optPrintOrPreview] = 1, A_NORMAL, A_PREVIEW)

Note that there's a space before the underscore on the first line (that's
how you specify that a command is continued on another line)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Girl Seeking Access Help said:
Hi Larry,
I tried it but it keeps giving me syntax error message.
--
Anna


Larry Daugherty said:
The below snippet of code is taken from one of the "execute" command
buttons that causes a form to be either Previewed or Printed
immediately depending on the state of two radio buttons in an option
box that toggle each other. The sense of the line of code with the
DcCmd is:

print the report whose name is in local string variable DocName. If
the value of Me!optPrintOrPrieview = 1 then print the report
immediately, else just display it for preview. There is (or used to
be) complete information in Access Help including useful examples.



Dim DocName As String

DocName = "rptLineCountSortedbyDate"
DoCmd.OpenReport DocName, IIf(Me![optPrintOrPreview] = 1,
A_NORMAL, A_PREVIEW)



HTH
--
-Larry-
--

"Girl Seeking Access Help"
Gee...
Now I have a problem...
the form has command buttons to preview and print certain reports. They
don't work now. I undid the entire precedure and only then the command
buttons worked again. Please help!! I really want to hide the access menu
(it looks much more professional!) but i definetily need to be able to call
the reports from the form.
--
Anna


:

"Girl Seeking Access Help"
wrote in message Hi Dirk,
I followed the instructions above and it WORKED!!! The instructions were
great and easy to follow. It took it me a couple of minutes to figure out
PopUp and Modal were in the "other" tab, but other than that... it worked
like a charm!!
Thank you very much
--
Anna


You're welcome, Anna.

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)
 
D

Dirk Goldgar

Girl Seeking Access Help said:
Gee...
Now I have a problem...
the form has command buttons to preview and print certain reports. They
don't work now. I undid the entire precedure and only then the command
buttons worked again. Please help!! I really want to hide the access
menu
(it looks much more professional!) but i definetily need to be able to
call
the reports from the form.


The problem here is that the reports are running within the Access
application window, and you've hidden that. It is theoretically possible to
force the reports to show outside the Access window, too, but I have not yet
managed to do that. The best I have been able to do is to open the report
sized to fit the Access window, then show the Access window again, and hide
the Access window when the report is closed.

These complications make the business of hiding the Access window useful
only for limited applications. The only application where I use it, I have
main form that is shown while hiding the application window, but I show the
window again if the user wants to do anything else, like preview reports.
 

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