Re: Startup Form Option

From: Marshall Barton (marshbarton_at_wowway.com)
Date: 09/24/04


Date: Fri, 24 Sep 2004 11:50:00 -0500

Neil Cash wrote:

>I have a form on startup, displaying a disclaimer message along with three
>options: one to continue to the main switchboard, one to exit access, and
>hopefully one like the HideStartupForm control in the "Northwind Traders"
>sample database. The problem with the sample database is that the option
>goes into the startup settings and changes the form startup. This is good,
>but I have several users and I'd like to give all users this option. My idea
>was to create a table (2 fields, User and HideStartup(Yes/No)) that "logs"
>you in and records your selection. And in the On Open event of the startup
>form, I'd like Access to go to the record containing the current user check
>the HideStartup Field, and depending on the selection go to the main
>switchboard or stay in the startup form. Does anyone know the code to go to
>a record and check for that option, my current code is:
>
>Private Sub Form_Open(Cancel As Integer)
>On Error GoTo Startup_err
>
>[Input Record Selecting Command Here]
>
>If HideStartup Then
> DoCmd.Close
> DoCmd.OpenForm "Switchboard"
> Else
> Exit Sub
>End If
>
>Startup_err:
>Exit Sub
>
>End Sub
>
>Is this the best way to do this, or is there a better way?

Since you mention "several users" and setting the Startup
settings changes it for all users, I conclude that you have
not split your database into a front end MDB (all the
queries, forms, Reports, etc) and a back end MDB with the
data tables. You need to seriously consider this split for
many reasons, one of which is that when each user has their
own copy of the front end on their local disk, you wouldn't
be having this problem. A major reason to split are that
you can develop new/changed forms/reports/etc and install
the changes without messing with the data tables. Another
is that it is notoriously unreliable to have multiple copies
of the same file open at the same time. This is a very
important concept that almost all professional Access
developers adhere to for every application. See Tony's site
for more info:
        http://www.granite.ab.ca/access/splitapp/index.htm

As for your specific question, you can use the DLookup
function to retrieve the hide startup value from the table:
DLookup("HideStartup", "thetable", "User=""" & who & """"

I have no idea how you determine who the user is, so I can't
be specific about that part. If you're using Access
Security, it could be as simple as Application.CurrentUser

-- 
Marsh
MVP [MS Access]


Relevant Pages

  • Startup Form Option
    ... I have a form on startup, displaying a disclaimer message along with three ... one to continue to the main switchboard, one to exit access, and ... Exit Sub ...
    (microsoft.public.access.formscoding)
  • Re: init.d startup script does not exit
    ... I have a script that launches a program. ... However, if I exit the shell, it kills ... during startup, but it keeps on going during startup and never starts ...
    (Debian-User)
  • Re: init.d startup script does not exit
    ... I have a script that launches a program. ... However, if I exit the shell, it kills ... during startup, but it keeps on going during startup and never starts ...
    (Debian-User)
  • init.d startup script does not exit
    ... it keeps on running in the shell. ... It is a webserver, so I ... However, if I exit the shell, it kills ... during startup, but it keeps on going during startup and never starts ...
    (Debian-User)
  • Re: init.d startup script does not exit
    ... I have a script that launches a program. ... However, if I exit the shell, it kills ... during startup, but it keeps on going during startup and never starts ...
    (Debian-User)