?
Solved

Creating Special Statup Options

Posted on 2008-10-27
11
Medium Priority
?
268 Views
Last Modified: 2013-11-29
Hello,

I have a Macro called "AutoExec". with a Runcode in it called "AutoExec()"

I have a module called 1234 with the following code below.

I am user mf431. As you can see, when I sign in, I can see the database window, but when others sign in, they get form called "View Reports"

 However, I need to bring back more options  when I am signed in becuase I am going to be disabling the "Shift" key. I have also "UNCHECKED" all of the options in Tools/Startup.......

Basically, I am trying to create a special startup for myself vs the other users. For example, I need the following
1. Full Menus (File, edit, view, etc......)
2. Need the full "database" toolbar.
3. I created a custom toolbar called "Preview" that will load when others sign in.

NewBi22
Function AutoExec()
 
If CurrentUser() = "mf431" Then
DoCmd.SelectObject acTable, "", True
Else
DoCmd.SelectObject acTable, "", True
RunCommand acCmdWindowHide
DoCmd.OpenForm "View Reports", acNormal
End If
End Function

Open in new window

0
Comment
Question by:Michael Franz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
11 Comments
 
LVL 46

Expert Comment

by:tbsgadi
ID: 22819558
0
 

Author Comment

by:Michael Franz
ID: 22826230
Gary,
I followed the steps provided. However, I am getting errors. I get a VB error on this:
ChangeProperty
Does it matter that I am using 2003.
I have been able to get the button to show only for me and get the hour glass, but I get the error.
 
Newbi22

Sub SetLimitedStartupProperties()
ChangeProperty "StartupForm", dbText, "Startup", True
ChangeProperty "StartupShowDBWindow", dbBoolean, False, True
ChangeProperty "StartupShowStatusBar", dbBoolean, True, True
ChangeProperty "AllowBuiltinToolbars", dbBoolean, False, True
ChangeProperty "AllowToolbarChanges", dbBoolean, False, True
ChangeProperty "AllowFullMenus", dbBoolean, False, True
ChangeProperty "AllowShortcutMenus", dbBoolean, False, True
ChangeProperty "AllowBreakIntoCode", dbBoolean, False, True
ChangeProperty "AllowSpecialKeys", dbBoolean, False, True
ChangeProperty "AllowBypassKey", dbBoolean, False, True
End Sub

Open in new window

0
 

Author Comment

by:Michael Franz
ID: 22826447
Gary,
More information. I took out the following line.
ChangeProperty "StartupForm", dbText, "Startup", True
Also changed all the Full Properties to True and all the Limited Propertise to False. This works nice, but here is the thing. I do not want all the properties available to all. I just want then limited to me.
Can I run an AutoExec macro to run upon load. The if CurrentUser = "mf431" Then
Give me all options
Else
Do not give me all options
End if
Newbi22
 
0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 

Author Comment

by:Michael Franz
ID: 22826816
Gary,
Newest addition. I need help here. I created a AutoExec macro with the Run code as Startup().
Below is my module to run upon startup. But it only works every other time. If I sign in, I get the correct options. Then I exit and sign in as another user, still my options. I exit and sign in again as that same user, I than get the correct option. But if I sign in again, I get the wrong options.
It is keeping the previous option for 1 more sign-in.
How do I stop that. Evaluate the code also. I have about 100 users of the database.
Newbi22

Function Startup()
 
If CurrentUser() = "mf431" Then
 
ChangeProperty "StartupShowDBWindow", dbBoolean, True
ChangeProperty "StartupShowStatusBar", dbBoolean, True
ChangeProperty "AllowBuiltinToolbars", dbBoolean, True
ChangeProperty "AllowToolbarChanges", dbBoolean, True
ChangeProperty "AllowFullMenus", dbBoolean, True
ChangeProperty "AllowShortcutMenus", dbBoolean, True
ChangeProperty "AllowBreakIntoCode", dbBoolean, True
ChangeProperty "AllowSpecialKeys", dbBoolean, True
ChangeProperty "AllowBypassKey", dbBoolean, True
 
Else
 
ChangeProperty "StartupShowDBWindow", dbBoolean, False
ChangeProperty "StartupShowStatusBar", dbBoolean, True
ChangeProperty "AllowBuiltinToolbars", dbBoolean, False
ChangeProperty "AllowToolbarChanges", dbBoolean, False
ChangeProperty "AllowFullMenus", dbBoolean, False
ChangeProperty "AllowShortcutMenus", dbBoolean, False
ChangeProperty "AllowBreakIntoCode", dbBoolean, False
ChangeProperty "AllowSpecialKeys", dbBoolean, False
ChangeProperty "AllowBypassKey", dbBoolean, False
 
End If
 
End Function
 
Function ChangeProperty(stPropName As String, _
PropType As DAO.DataTypeEnum, vPropVal As Variant) _
As Boolean
' Uses the DDL argument to create a property
' that only Admins can change.
'
' Current CreateProperty listing in Access help
' is flawed in that anyone who can open the db
' can reset properties, such as AllowBypassKey
'
On Error GoTo ChangeProperty_Err
 
Dim db As DAO.Database
Dim prp As DAO.Property
 
Const conPropNotFoundError = 3270
 
Set db = CurrentDb
' Assuming the current property was created without
' using the DDL argument. Delete it so we can
' recreate it properly
db.Properties.Delete stPropName
Set prp = db.CreateProperty(stPropName, _
PropType, vPropVal, True)
db.Properties.Append prp
 
' If we made it this far, it worked!
ChangeProperty = True
 
ChangeProperty_Exit:
Set prp = Nothing
Set db = Nothing
Exit Function
 
ChangeProperty_Err:
If Err.Number = conPropNotFoundError Then
' We can ignore when the prop does not exist
Resume Next
End If
Resume ChangeProperty_Exit
End Function

Open in new window

0
 
LVL 46

Expert Comment

by:tbsgadi
ID: 22828962
You're right.
You can only change the properties for the next time you open the database.
You should have a button to "lock" the database, and when you go in ,you"ll need to open the DB twice.
I have it that my database is always open & when  I release it to other users I close it.
I also add the attached code to my Startup just in case I release an open version by mistake.

 Set dbs2 = CurrentDb
     If dbs2.Properties("StartupShowDBWindow") Then
        If CurrentUser <> "mf431"  Then
           MBox "Call Admin for Support"
        DoCmd.Quit
        Exit Function
        End If
    End If

Open in new window

0
 

Author Comment

by:Michael Franz
ID: 22835328
Gary,
What type of Lockout code do you use.
Considering I disable the Shift key.
 
0
 
LVL 46

Expert Comment

by:tbsgadi
ID: 22838621
The same code as you use.
If you open the DB twice then AllowBypassKey will be true
0
 

Author Comment

by:Michael Franz
ID: 22845500
Gary,
I think I have it set up correct and understand how it works. But, this still does not stop someone from entering the system using the shift key. Am I correct or do I have to do that seperate.
Newbi22
0
 
LVL 46

Accepted Solution

by:
tbsgadi earned 2000 total points
ID: 22846102
you need to run the lock sequence to close the DB ie all the Changepoperty false & then nobody can use the bypass key
0
 

Author Closing Comment

by:Michael Franz
ID: 31510540
Many Thanks!!!
0
 
LVL 46

Expert Comment

by:tbsgadi
ID: 22850146
Glad to help!
0

Featured Post

Technology Partners: 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!

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses

762 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