View Single Post
  #1  
Old November 5th, 2004, 04:33 PM
external usenet poster
 
Posts: n/a
Default Can't Hide Form

Try this:

Private privateWidth As Long
Private privateHeight As Long


Private Sub Form_Activate()
'Show the form
DoCmd.MoveSize , , privateWidth, privateHeight
End Sub

Private Sub Form_Load()
privateWidth = Me.Width
privateHeight = Me.InsideHeight
End Sub


Private Sub cmdHide_Click()
'Hide the form
DoCmd.MoveSize , , 0, 0
End Sub

------
Alex


Dirk Goldgar wrote:
Nice idea! That exact method won't work because you've already made
the form invisible, so the Movesize is applied to whatever other
window then becomes active -- the database window if this was the
startup form. But you can use the InsideHeight and InsideWidth
properties, like this:

If mlngWidth 0 Then
Me.InsideHeight = mlngHeight
Me.InsideWidth = mlngWidth
End If

(having captured the dimensions in module-level variables mlngHeight
and mlngWidth in the Open event, before resizing to zero).

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

"John Spencer (MVP)" wrote in

message
...
Well, how about adding one line of code to resize the form in the

Form's Timer
event that occurs after you've turned the form invisible?

Private Sub Form_Timer()
Me.Visible = False
Me.TimerInterval = 0
'Size the form to its original size whatever that might be
DoCmd.MoveSize , , 2880, 1440
End Sub


Ken Snell wrote:

As a scientist, I just love experimenting and finding new info!

Thanks,
Dirk.

--
Ken Snell
MS ACCESS MVP

"Dirk Goldgar" wrote in message
news:#FUUnNtsCHA.2592@TK2MSFTNGP10...
As an additional note on this, I just found an interesting

trick. I
found that even making the form invisible after a timer

interval
of 1
millisecond was not enough to keep the form from flashing on

the
screen ever so briefly. BUT ... if you put this line of code

in
the
form's Open event:

DoCmd.MoveSize , , 0, 0

(setting its height and width to 0), and you also set its

BorderStyle
property to None, then you never see any trace of the form.

Granted,
it makes it a bit tricky to close the form manually, as you

still
can't see it if you unhide it, but that's as close as I've come

yet to
a traceless form.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

---------------SNIP-----------------------