Solved

Hiding Startup form

Posted on 2004-09-23
7
278 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
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.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now