Can't hide hidden form

J

Jim Shores

I've tried Open, Load, Activate and Current events but cannot get my frmHiddenForm to hide on startup. Me.Visible = False does work; it works from the Resize event. Will you help me out of my ignorance?
 
D

Dirk Goldgar

Jim Shores said:
I've tried Open, Load, Activate and Current events but cannot get my
frmHiddenForm to hide on startup. Me.Visible = False does work; it
works from the Resize event. Will you help me out of my ignorance?

I'm not sure that I understand you, but I know that it's tricky to have
a startup form -- as specified in the Tools -> Startup... dialog -- open
invisibly without even flashing on the screen for a moment. If that's
what you're trying to do, I've found this trick works:

'----- start of code for form module -----
Option Compare Database
Option Explicit

Dim mlngHeight As Long
Dim mlngWidth As Long

Private Sub Form_Open(Cancel As Integer)

mlngHeight = Me.WindowHeight
mlngWidth = Me.WindowWidth
DoCmd.MoveSize , , 0, 0

End Sub

Private Sub Form_Timer()

Me.Visible = False
Me.TimerInterval = 0
If mlngWidth <> 0 Then
Me.InsideHeight = mlngHeight
Me.InsideWidth = mlngWidth
End If

End Sub
'----- end of code for form module -----

A simpler alternative would be to have an Autoexec macro that opens the
desired form as hidden. Then you wouldn't specify the startup form in
the Tools -> Startup... dialog at all.
 

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