Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Hiding Startup form

Posted on 2004-09-23
Medium Priority
Last Modified: 2010-05-18
I have a form called frmLoginForm that when the user opens the program it checks to see if he/she is autorized to access it and if so logs their name, date and time to a table. It then opens the form frmMainMenu that gives them access to the database. I want to hide this for from the users view and run behind the scene. I have my code in the Form_Load property. The problem is the for stays visible after it opens the form frmMainMenu. Here is my code, some please give me an idea, I have tried .hide, .visible = false and nothing seems to work.

      Dim db As Database
      Dim rst As Recordset
      Dim strName As String
      Dim strSQL As String
      Set db = CurrentDb()
      Set rst = db.OpenRecordset("tblOCCTeam")
      strName = GetCurrentChangeName

      If Not rst.EOF Then
            Do While Not rst.EOF
                If strName = rst!LanID.Value Then
                        strSQL = "INSERT INTO tblRecStatus(EmployeeName,Status) " & _
                        "VALUES(" & _
                                    " '" & rst!EmployeeName.Value & " ','" & "Signed On" & "')"
                        Debug.Print strSQL
                        DoCmd.RunSQL (strSQL)
                        DoCmd.OpenForm "frmMainMenu"
                        Exit Sub
                  End If
            MsgBox "You do not have permission to access this Database, Please contact the OCC Team Supervisor if access is needed."
      End If
Question by:tkrpata
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2

Accepted Solution

JonoBB earned 1000 total points
ID: 12134929
Why even have the frmLoginForm?

You can bypass using that form by calling your code above from the autoexec macro......

That way, your code above will always run automatically, and only open frmMainMenu if they are authorised...

Make sense?
LVL 17

Expert Comment

ID: 12134995
I'd agree you may not need the form.
You could use the autoexec as jono suggested OR
you could put this code in the onOpen event of the mainMenu
or why not just have
docmd.close right before docmd.openform "frmMainMenu"?


Author Comment

ID: 12135113
Didn't even think about that, works great, thanks alot..
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.


Expert Comment

ID: 12135139
No problem, glad I could help

but howcome you gave the points to waltercook? (Sorry Walter)
LVL 17

Expert Comment

ID: 12135143
Looks like you accepted the wrong one, tk.  If that's the case you can post a question in Community Support with a link to this one and have them change it.


Author Comment

ID: 12136568
Will do, thanks

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question