[AccessD] Database Startup Properties

Mitsules, Mark S. (Newport News) Mark.Mitsules at ngc.com
Tue May 11 06:59:17 CDT 2004


Jeffrey, that is precisely what I'm trying to do...thanks.  I'm using a
launcher application to open the front end so your approach should work just
fine for me.  It appears that you are doing the same...is this correct?


Mark


-----Original Message-----
From: Dan Waters [mailto:dwaters at usinternet.com] 
Sent: Monday, May 10, 2004 7:40 PM
To: 'Access Developers discussion and problem solving'
Subject: RE: [AccessD] Database Startup Properties


Mark,

I use code very similar to this, but as part of Administrative functions,
not in the startup routine.  

Changing the database properties takes effect only after you exit out and
re-open your system.  The changes will then apply to everyone who opens the
database.

Dan

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
jeffrey.demulling at usbank.com
Sent: Monday, May 10, 2004 3:11 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Database Startup Properties


Hopefully this can help you get started.  I have it in my splash screen.

'Now if the user is marked as being a programmer ask what mode to open
application
    con = setconnection
    con.Open

    cmdtext = "SELECT"
    cmdtext = cmdtext & " tblUsers.[User LAN Id],"
    cmdtext = cmdtext & " tblUsers.[User Name],"
    cmdtext = cmdtext & " tblUsers.Programmer"
    cmdtext = cmdtext & " FROM"
    cmdtext = cmdtext & " tblUsers"
    cmdtext = cmdtext & " WHERE"
    cmdtext = cmdtext & " tblUsers.[User LAN Id]='" & GetTheCurrentUser &
"'"
    cmdtext = cmdtext & " AND"
    cmdtext = cmdtext & " tblUsers.Programmer<>0;"

    rs.Open cmdtext, con

    If Not rs.EOF And Not rs.BOF Then    'User is a programmer
        rs.MoveFirst
        mymessage = "Hello " & rs.Fields("User Name") & Chr(10) & Chr(13)
        mymessage = mymessage & "Open Application for Repairs/Debugging?"
        myresponse = MsgBox(mymessage, 36, "Question")

        'Close the connection
        con.Close

        If myresponse = 6 Then    'Open application in design mode -
ansewered yes to question
            mymessage = "Opening Application in Design Mode." & Chr(10) &
Chr(13)
            mymessage = mymessage & "Please don't hurt me to much."

            ChangeProperty "StartupForm", dbText, "frmSplash"
            ChangeProperty "StartupShowDBWindow", dbBoolean, True
            ChangeProperty "StartupShowStatusBar", dbBoolean, True
            ChangeProperty "AllowBuiltinToolbars", dbBoolean, True
            ChangeProperty "AllowFullMenus", dbBoolean, True
            ChangeProperty "AllowBreakIntoCode", dbBoolean, True
            ChangeProperty "AllowSpecialKeys", dbBoolean, True
            ChangeProperty "AllowBypassKey", dbBoolean, True

            DoCmd.ShowToolbar "Menu Bar"

            MsgBox mymessage, vbOKOnly, "Welcome"

            DoCmd.Close acForm, "frmSplash"
            Exit Sub
        Else    'Open in normal mode - ansewered no to question
            mymessage = "Opening Application for Normal Use." & Chr(10) &
Chr(13)
            mymessage = mymessage & "Have a nice day."

            MsgBox mymessage, vbOKOnly, "Welcome"

            DoCmd.OpenForm "frmMainMenu"
            Exit Sub
        End If
    Else
        con.Close

        cmdtext = "SELECT"
        cmdtext = cmdtext & " tblUsers.[User LAN Id],"
        cmdtext = cmdtext & " tblUsers.[User Name]"
        cmdtext = cmdtext & " FROM"
        cmdtext = cmdtext & " tblUsers"
        cmdtext = cmdtext & " WHERE"
        cmdtext = cmdtext & " tblUsers.[User LAN Id]='" & GetTheCurrentUser
& "';"

        con = setconnection
        con.Open

        rs.Open cmdtext, con

        rs.MoveFirst
        mymessage = "Hello " & rs.Fields("User Name") & Chr(10) & Chr(13)
        mymessage = mymessage & "I have determined that you are an
authorized user." & Chr(10) & Chr(13)
        mymessage = mymessage & "Please feel free to proceed and have a
nice day."

        'Close the connection
        con.Close

        ChangeProperty "StartupForm", dbText, "frmSplash"
        ChangeProperty "StartupShowDBWindow", dbBoolean, False
        ChangeProperty "StartupShowStatusBar", dbBoolean, True
        ChangeProperty "AllowBuiltinToolbars", dbBoolean, False
        ChangeProperty "AllowFullMenus", dbBoolean, False
        ChangeProperty "AllowBreakIntoCode", dbBoolean, False
        ChangeProperty "AllowSpecialKeys", dbBoolean, False
        ChangeProperty "AllowBypassKey", dbBoolean, False

        Application.SetOption "Error Trapping", 2

        MsgBox mymessage, vbOKOnly, "Welcome"

        DoCmd.OpenForm "frmMainMenu"
        Exit Sub
    End If




Function ChangeProperty(strPropName As String, varPropType As Variant,
varPropValue As Variant) As Integer
    Dim dbs As DAO.database
    Dim prp As DAO.Property
    Const conPropNotFoundError = 3270

    Set dbs = CurrentDb
    On Error GoTo Change_Err
    dbs.Properties(strPropName) = varPropValue
    ChangeProperty = True

Change_Bye:
    Exit Function

Change_Err:
    If Err = conPropNotFoundError Then  ' Property not found.
        Set prp = dbs.CreateProperty(strPropName, varPropType,
varPropValue)
        dbs.Properties.Append prp
        Resume Next
    Else
        ' Unknown error.
        ChangeProperty = False
        Resume Change_Bye
    End If
End Function


 

                      "Mitsules, Mark S.

                      (Newport News)"                  To:
"'[AccessD]'" <AccessD at databaseadvisors.com>

                      <Mark.Mitsules at ngc.com>          cc:

                      Sent by:                         Subject:  [AccessD]
Database Startup Properties                                         
                      accessd-bounces at databasea

                      dvisors.com

 

 

                      05/10/2004 02:48 PM

                      Please respond to "Access

                      Developers discussion and

                      problem solving"

 

 





Can someone point me in the direction of a short tutorial on database
startup properties?  I have seen tools for setting these properties
remotely
ala http://www.jamiessoftware.tk/propeditor/pe_download.html, but I'm
looking for examples on how to roll-my-own.  I'm trying to create an
automated routine that toggles all the appropriate properties for an
administrator login (full menus, shortcuts, show database window, etc.).



Mark
--
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com






-- 
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

-- 
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list