Solved

Hiding Startup form

Posted on 2004-09-23
7
283 Views
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

      rst.MoveFirst
      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
                  rst.MoveNext
            Loop
            MsgBox "You do not have permission to access this Database, Please contact the OCC Team Supervisor if access is needed."
            DoCmd.Quit
      End If
0
Comment
Question by:tkrpata
  • 2
  • 2
  • 2
7 Comments
 
LVL 8

Accepted Solution

by:
JonoBB earned 250 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?
0
 
LVL 17

Expert Comment

by:walterecook
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"?

Walt
0
 
LVL 1

Author Comment

by:tkrpata
ID: 12135113
JonoBB,
Didn't even think about that, works great, thanks alot..
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 8

Expert Comment

by:JonoBB
ID: 12135139
No problem, glad I could help

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

Expert Comment

by:walterecook
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.

Walt
0
 
LVL 1

Author Comment

by:tkrpata
ID: 12136568
Will do, thanks
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

735 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