Hide Access and Open Form??

S

Stuart

In Word, I sometimes use code like this:
application.visible=false
frmXXXXX.Show
To hide Word and open a form. That way the form shows, but Word does not.

Can I do something similar in Access? I'd like to have a form open, but
have Access either minimized or not visible.

Thanks for your help.
 
M

MaBell

Doug,

I follow the Access Web instructions for this code and it doesn't work for
me. My switchboard form is popup and set to open on startup and i call:

Private Sub Form_Open(Cancel As Integer)
Call fSetAccessWindow(SW_HIDE)
End Sub

but I keep getting the "Cannot hide Access unless a form is on screen"
message.

Am I missing something?
 
R

Rick Brandt

MaBell said:
Doug,

I follow the Access Web instructions for this code and it doesn't work for
me. My switchboard form is popup and set to open on startup and i call:

Private Sub Form_Open(Cancel As Integer)
Call fSetAccessWindow(SW_HIDE)
End Sub

but I keep getting the "Cannot hide Access unless a form is on screen"
message.

Am I missing something?

It's a timing issue. I found that I had to put the code in the Timer event and
use a very small timer interval. The Open and Load events were just too soon
(In Access 97) though those events seemed to work ok for me with Access 2000.
 
M

MaBell

hi Rick. thanks for the reply. I understand but could you give me a little
example to get me going? Thanks.
 
R

Rick Brandt

MaBell said:
hi Rick. thanks for the reply. I understand but could you give me a little
example to get me going? Thanks.

You currently execute the code to hide the Access window in the Form's Open
event. Simply move it to the Form's Timer event. Then enter a value in the
Form's TimerInterval property to determine how long before the Timer code runs.

The TimerInterval accepts numbers representing milliseconds so an entry of 250
means that the Form will open, wait 250 milliseconds and then execute the code.
Normally the Timer event will keep firing over and over as long as the Form is
open so you need to add a line that will cause the code to execute only once.
Setting the TimerInterval to zero accomplishes that.

Call fSetAccessWindow(SW_HIDE)
Me.TimerInterval = 0

You can experiment with shorter and shorter TimerInterval values until you find
the smallest value that still works.
 
M

MaBell

Thanks Rick! That worked. Another question:

So my switchboard opens on my desktop and my access window is minimized but
when I click on a button to open another form, the form opens inside the
minimized access window. Do I have to change the properties of all my forms
so they all popup on the desktop? THANKS
 
R

Rick Brandt

MaBell said:
Thanks Rick! That worked. Another question:

So my switchboard opens on my desktop and my access window is minimized but
when I click on a button to open another form, the form opens inside the
minimized access window. Do I have to change the properties of all my forms
so they all popup on the desktop? THANKS

Yep. All forms have to be set to Popup = true or be opened with the acDialog
argument.

I have never used this technique on an app that even HAD more than one form. If
your trying to run a full blown app this way be prepared for lots of problems.
 
M

MaBell

Thanks Rick. I am scrapping the idea.

I have done some development but I have never had my application go into
production. My question is, If I wanted my users to run my application they
have to do it within Access? is this industry standard? I always assumed
you could create an .exe version like VB but I heard thats not possible. So
the best I can do is create tight security, a .MDE file and maybe hide the
menu bars???
 
R

Rick Brandt

MaBell said:
Thanks Rick. I am scrapping the idea.

I have done some development but I have never had my application go into
production. My question is, If I wanted my users to run my application they
have to do it within Access? is this industry standard? I always assumed
you could create an .exe version like VB but I heard thats not possible. So
the best I can do is create tight security, a .MDE file and maybe hide the
menu bars???

Yep, an Access app needs Access to run. Everything you indicate is the way to
proceed.

Personally whenever possible I use a server-based back end and use its security
tools for protecting the data. Then I simply distribute an MDE and don't bother
with Access security. Given how easy it is to be circumvented anyway I just
don't think it's worth the trouble.
 
J

JoeB

Rick Brandt said:
You currently execute the code to hide the Access window in the Form's Open
event. Simply move it to the Form's Timer event. Then enter a value in the
Form's TimerInterval property to determine how long before the Timer code runs.

The TimerInterval accepts numbers representing milliseconds so an entry of 250
means that the Form will open, wait 250 milliseconds and then execute the code.
Normally the Timer event will keep firing over and over as long as the Form is
open so you need to add a line that will cause the code to execute only once.
Setting the TimerInterval to zero accomplishes that.

Call fSetAccessWindow(SW_HIDE)
Me.TimerInterval = 0

You can experiment with shorter and shorter TimerInterval values until you find
the smallest value that still works.
 
J

JoeB

MaBell said:
Thanks Rick! That worked. Another question:

So my switchboard opens on my desktop and my access window is minimized but
when I click on a button to open another form, the form opens inside the
minimized access window. Do I have to change the properties of all my forms
so they all popup on the desktop? THANKS
 

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