Solved

Hiding Startup form

Posted on 2004-09-23
7
281 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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 
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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

778 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