Startup/autoexec

P

pvdalen

Hi all,

Hopefully this is simple:

I wanted to hide the Access application window at startup. Not the database
window, but the actal, big Access window. I perused the board and came up
with a suggestion of:

docmd.RunCommand acCmdWindowHide

I put that in the Load event of my startup form, and I also created an
AutoExec macro with that command in it. Plus, I unchecked everything else on
the Startup Wizard. But, when I enter the program, I get the splash page,
but i get it in an Access window. I just want to bring up the splash page.

Am I missing something simple?

Thanks very much for all the help; past, present and future.

Paul
 
P

pvdalen

Hey Jeff,

Thanks for the quick reply.

I followed the instructions on the link, but, when I open the database, with
the code from the link as a seperate module and a function call in the Open(
) event of the splash page, I'm getting this message:

"Can't hide Access unless a form is on screen" which comes right from this
bit of code:

Set loForm = Screen.ActiveForm
If Err <> 0 Then 'no Activeform
If nCmdShow = SW_HIDE Then
MsgBox "Cannot hide Access unless " _
& "a form is on screen"
Else
loX = apiShowWindow(hWndAccessApp, nCmdShow)
Err.Clear
End If

I tried moving the function call to the Activate( ) and Load( ) events of
the splash form; got the same message. I tried the GotFocus( ) event, but
the function was never called.

I did set the form's popup property to "Yes". I think I did everything
correctly. It seems the function runs as it should, not recognizing an open
form and escaping with the error message. Can you determine if I've missed
anything or if I have to make any modifications?

Thanks again,
Paul
 
J

Jeff Conrad

Here are some instructions I have previously posted before in the NGs
about this code:
1. Create a back-up copy of your database file. Don't skip t­his step!!
2. Go to this web site:

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

Copy all that code to a new standard module.
Module, not form module!

3. Compile the code, save the module and name it modHideAcce­ssWindow.
4. Open your main form (the one that you want the users to s­ee) and go to Design View.
5. Set these Form's Properties:

Auto Center- Yes
Pop-Up - Yes
Modal - Yes

6. Open the code behind the form and copy this code into the­ Form's Open event:

Private Sub Form_Open(Cancel As Integer)

Me.Visible = True
fSetAccessWindow (SW_HIDE)

End Sub

7. You MUST put an exit command button on this form that clo­ses
all of Access. Something with a line like:

DoCmd.Quit

...in the button's Click event.

8. Compile the code, close and save the form.
9. Close the database and then re-open. It *should* now comp­letely
hide the Access window and only show the data entry form.
Let me know if you have problems.
 
E

ericyao

I used this method on my start form, a switch board. But when I click the
button there to open other form, it wont let me go to that form, only with
warning sound when I want to click on other forms or window after I switched
to show
Here's the code:
Private Sub Command33_Click()
fSetAccessWindow (SW_SHOWNORMAL)
End Sub

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

antthing wrong with it?

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