Hiding Application Window Not Working

E

Eric G

I want to hide the main Access application window immediately after opening a
form in my database. The form name is frm_Welcome. I am using code from
this link:

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

I have tried putting the statment "fSetAccessWindow(SW_HIDE)" in just about
every event in the "frm_Welcome" class, including Open, Load, Current,
Activate, etc. No matter where I put the statement, I always get the error
message "Cannot hide Access unless a form is on screen". Where do I place
this statement in order to make it work? The problem is that the form
doesn't display on the screen after any of the initial events. That's why I
get the error message.

After I get that error message, the form shows up as usual, but the Access
window is not hidden. I have set the form to Modal and Popup.

Thanks in advance,

Eric
 
E

Eric G

Figured it out - I stuck it in the timer routine for the form, and then
turned off the timer after hiding the Access window.

However, now I have another issue - when the user clicks on a button on the
form (e.g. the "Save Data" button) and a msgbox is put up, after the user
dismisses the msgbox, the form goes to the back of all the open windows on
the desktop. I have to close all the other windows to get back to the form,
because the application window is not showing in the taskbar!

Does anyone know a good way to ensure that the form comes back to the top of
all the windows?

Thanks,

Eric
 
D

Dirk Goldgar

Eric G said:
I want to hide the main Access application window immediately after opening
a
form in my database. The form name is frm_Welcome. I am using code from
this link:

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

I have tried putting the statment "fSetAccessWindow(SW_HIDE)" in just
about
every event in the "frm_Welcome" class, including Open, Load, Current,
Activate, etc. No matter where I put the statement, I always get the
error
message "Cannot hide Access unless a form is on screen". Where do I place
this statement in order to make it work? The problem is that the form
doesn't display on the screen after any of the initial events. That's why
I
get the error message.

After I get that error message, the form shows up as usual, but the Access
window is not hidden. I have set the form to Modal and Popup.

Thanks in advance,


I find that I have to force the form to be visible before hiding the
application window, like this:

Private Sub Form_Open(Cancel As Integer)
Me.Visible = True
DoEvents
fSetAccessWindow SW_HIDE
End Sub
 
D

Dirk Goldgar

Eric G said:
Figured it out - I stuck it in the timer routine for the form, and then
turned off the timer after hiding the Access window.

However, now I have another issue - when the user clicks on a button on
the
form (e.g. the "Save Data" button) and a msgbox is put up, after the user
dismisses the msgbox, the form goes to the back of all the open windows on
the desktop. I have to close all the other windows to get back to the
form,
because the application window is not showing in the taskbar!

Does anyone know a good way to ensure that the form comes back to the top
of
all the windows?


Hidingthe Access application window isn't really suitable unless you're only
going to have one form window on the screen at a time, or maybe two that are
carefully positioned. So I haven't encountered the problem, and am not sure
about the best way to handle it. Have you tried, in the code following the
MsgBox() call, executing

DoCmd.SelectObject acForm, Me.Name

I would expect that to activate the form containing the code.
 
E

Eric G

Seems like somewhere in all the options I tried, that was one of them, but
I'll try it again. It would be better than my use of the form timer.

Thanks,

Eric
 
E

Eric G

I am having only one form open at a time - initially, the "Welcome" form,
then the "User Input" form. Access is extremely restricted by directive from
my bosses because of the sensitive nature of the data. I have it working
pretty well now.

Thanks for your inputs!

Eric
 

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