Access form does not open hidden as requested RRS feed

  • Question

  • Hi I am somewhat new to Access vba but have learned quite a bit. I have used the achidden property to open forms successfully in the past. However, I am trying to modify a database front-end that someone created before me, and he no longer works for our agency. In particular, when the main menu opens as the database is loaded, it opens a form to query a table using the username to filter the results given from the back end. The problem is I have tried changing the acWindowNormal attribute to acHidden, but it doesn't work, the form still shows, there is a tab at the top with it's name and it shows when you click the tab. I have also tried using the constant "1". Using Access 2016. The vba code is in the "OnOpen" action of the "main_menu" form that automatically opens when the database is opened. The code:


    DoCmd.OpenForm "Security_Current_User_Name", , , acHidden

    I have explored the form to see if anything might be causing this, but I cannot see anything that I know of that might. There is only one line of code in the vba for that form's actions:

    Private Sub Form_Open(Cancel As Integer)
        Current_User = UCase(Environ("UserName"))
    End Sub

    I can't imagine that this would cause the form to "unhide." The form invokes a simple query to a back-end linked table, and produces a number as a result, to be used in future query filters.

    I just want the form to open hidden, so my colleagues can use the database with a minimum of confusion. But I don't want the form to hide if I open it manually from the navigation pane (which the other users won't have). Any ideas?

    Wednesday, October 3, 2018 1:03 PM


  • Whoops, found the problem duh.  Needed two more commas.  Sorry to bother anyone.

    Coding is 50% programming and 95% debugging

    • Marked as answer by HalloweenWeed Wednesday, October 3, 2018 1:40 PM
    Wednesday, October 3, 2018 1:40 PM