Unable to hide form?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

When my database starts up my startupfrm loads it then call my swichboard. I've tried to render my startupfrm invisible but it doesn't seem to work. Why? I need it to be active because it is use to keep a constant link to my back end as well as permit me certain other functionalities (kick off users...). However, I don't want it to be visible because user can then close it making my life a living hell.....

Back to the subject, is there a reason why a form cannot be made invisible? Is there another option that I should be looking at?

Thank you for the help

Daniel
 
I open my form through a module which is called as part of my autoexec
macro. In the module I have code...

Public Function LogUser()
:
:
' Opens Form to constantly check database status
DoCmd.OpenForm "Logon", acNormal, "", "", , acHidden

End Function





Rick B

Hello,

When my database starts up my startupfrm loads it then call my swichboard.
I've tried to render my startupfrm invisible but it doesn't seem to work.
Why? I need it to be active because it is use to keep a constant link to my
back end as well as permit me certain other functionalities (kick off
users...). However, I don't want it to be visible because user can then
close it making my life a living hell.....

Back to the subject, is there a reason why a form cannot be made invisible?
Is there another option that I should be looking at?

Thank you for the help

Daniel
 
Put the following statement in the Open event of your form.

Me.Visible = False

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


Daniel said:
Hello,

When my database starts up my startupfrm loads it then call my swichboard.
I've tried to render my startupfrm invisible but it doesn't seem to work.
Why? I need it to be active because it is use to keep a constant link to my
back end as well as permit me certain other functionalities (kick off
users...). However, I don't want it to be visible because user can then
close it making my life a living hell.....
Back to the subject, is there a reason why a form cannot be made
invisible? Is there another option that I should be looking at?
 
Daniel said:
Rick,

I've created an autoexec macro per your last post (as shown below)
but it still is visible. Any ideas?

Function Startup()
DoCmd.OpenForm "frmlogoff", , , , , acHidden
DoCmd.OpenForm "main menu"
End Function

Using Rick's method, you must also change your Tools -> Startup...
settings so that "frmlogoff" is no longer your application's startup
form. That way, Access won't open it automatically; only your Autoexec
macro will do it. You don't actually have to write a function and call
it from the Autoexec macro -- you can use macro actions in the macro
itself to open the forms. However, it should work either way.
 
Lynn Trapp said:
Put the following statement in the Open event of your form.

Me.Visible = False

In my experience, that results in the form flashing very briefly on the
screen. I worked out a way around that, involving setting the form's
height and width to 0 in the Open event, then hiding and resizing it in
a Timer event, but I really think using an Autoexec macro is simplest.
 
In my experience, that results in the form flashing very briefly on the
screen. I worked out a way around that, involving setting the form's
height and width to 0 in the Open event, then hiding and resizing it in
a Timer event, but I really think using an Autoexec macro is simplest.

Well, it's kind of bizarre, Dirk. I have always done it from an Autoexec
macro myself but tried it with a form for the OP and it was working. Then I
posted the message. Then I closed and saved the form and tried to open it,
but it was visible. After several attempts I opened the form in design view
again and then opened it in Form view from there. Lo, and behold, it was
invisible. Thus, it seems the statement works fine when you open the form
to Form view from design view but not if you simply try to open the form.
Have you ever seen that before?
 
Lynn Trapp said:
Well, it's kind of bizarre, Dirk. I have always done it from an
Autoexec macro myself but tried it with a form for the OP and it was
working. Then I posted the message. Then I closed and saved the form
and tried to open it, but it was visible. After several attempts I
opened the form in design view again and then opened it in Form view
from there. Lo, and behold, it was invisible. Thus, it seems the
statement works fine when you open the form to Form view from design
view but not if you simply try to open the form. Have you ever seen
that before?

Huh. I could have sworn I had found that a startup form setting
Me.Visible = False in its Open event resulted in a brief flash of the
form, but now I'm getting the same behavior you are. I must have done
something else before -- maybe just hiding the form in the Timer event,
but not resizing it. I don't remember.

If you're interested, this is what I did that worked (but which seems
undesirably elaborate):

'----- start of form's code 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 form's code module -----

The form's TimerInterval is initially set to 1, so the Timer event will
fire as soon as possible.
 
Thanks Dirk. I'll keep that approach in mind, but I think you are right that
it a bit to much for something that can be done easily with the AutoExec
macro.
 
Back
Top