Search code examples
ms-accessvbavisible

Visibility Property resets after exiting Load() subroutine (MS-ACCESS 03, 07, 10)


I have a form that opens at startup (frmStart). That form has some code in the Load method which decides whether the user should see the switchboard (admins) or an alternate form (regular users).

I want to keep "frmStart" open after the decision is made, but I want it to disappear. I have stepped through the code, and used the immediate window to find out that frmStart.Visible = False. However, after the command "exit sub", frmStart.Visible = True again.

I'm not sure what is causing the property to reset, but I would really like to hide the ugly "frmStart" form. Does anybody have any suggestions?

Thanks in advance for any help you may be able to provide.


Solution

  • So, are you trying to make the Form disappear once the desired condition is true, or you are trying to keep the form from appearing before you get to it? If the former is true, you'd want to perhaps re-write your logic so that the Form_Open event isn't triggered in the first place (so the form isn't called) and would in practicality be Visible = False.

    If the latter is true, then you are going wrong by the Form_Open subroutine even being called - since the call was placed for the form to be opened. Look through your logic before this event to make sure that the conditions are satisfied and to call an alternate form.

    Sorry in advance for the vague advice, you did not provide more structured information so I am trying to be 'as correct as I can'.