[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Microsoft Access 2007 AutoExec Macro

Posted on 2009-04-20
10
Medium Priority
?
3,518 Views
Last Modified: 2013-11-29
Hi,

I understand the basic concept of an AutoExec Macro and how to perform simple tasks like opening forms.  However, I would like to essentially hide everything from the user except for the application itself when the app opens.  

I am not exactly sure where to begin to develop these controls and was hoping someone had a good resource for creating the AutoExec macro with respect to what I have mentioned above.

Any and all suggestions are welcome and appreciated.  Thanks.
0
Comment
Question by:bmav25
  • 5
  • 5
10 Comments
 
LVL 65

Expert Comment

by:rockiroads
ID: 24191738
So you want to hide such things as tables, menu options etc?
In previous versions, it was possible using Tools/Startup

in A2007, I believe it would be like this

managing database window = office button/access options/current database/go to navigation section/check or uncheck navigation pane to display or not display
below that is ribbon and toolbar
further up in application options, look for use access special keys to disable shortcuts to menu options

be careful not to lock out too much. I dont know if you can still use the SHIFT approach here.
0
 

Author Comment

by:bmav25
ID: 24193207
Thanks for the response.

Ok,  I understand that approach.  But, is there a way I can write that with code?  That way you don't have to undo all those options when you want to change things .
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 24193745
ok, I had this code in A2003 but not tried in A2007. I cant imagine properties to have differed though

Add this to a module and run setAppproperties. You  need to restart database to see changes. Suggest you try on a dummy db to see if it works fine.


Sub SetAppProperties()
   
    Dim bSet As Boolean

'Set to fals to disable, true to enable    
    bSet = false
   
    ChangeAppProperty "StartupShowDBWindow", bSet
    ChangeAppProperty "StartupShowStatusBar", bSet
    ChangeAppProperty "AllowBuiltinToolbars", bSet
    ChangeAppProperty "AllowToolbarChanges", bSet
    ChangeAppProperty "AllowFullMenus", bSet
    ChangeAppProperty "AllowShortcutMenus", bSet
End Sub

Sub ChangeAppProperty(ByVal sName As String, ByVal bValue As Boolean)
   
    Dim prp As dao.Property

    On Error Resume Next
    CurrentDb.Properties(sName) = bValue
    If err.Number = 3270 Then
        Set prp = CurrentDb.CreateProperty(strPropName, dbBoolean, bValue)
        CurrentDb.Properties.Append prp
    End If
End Sub
0
Industry Leaders: 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!

 

Author Comment

by:bmav25
ID: 24195849
Thank rockiroads.  I wont have time to check it now, but I will comment later tonight to let you know how it works.  This is exactly what I was looking for.
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 24196068
Ok, no probs.
There is a typo in my code

from
Set prp = CurrentDb.CreateProperty(strPropName, dbBoolean, bValue)

change to
Set prp = CurrentDb.CreateProperty(sName, dbBoolean, bValue)


0
 

Author Comment

by:bmav25
ID: 24197250
Ok, so I copied the corrected code into a module.  I used the Action "RunCode" with the argument "SetAppProperties".  This gives me an error that says can't find "SetAppProperties".  

I noticed that the argument accepted by RunCode is only functions, which may be why I am getting the error.  Other than that, there are no Actions that would seem to work for a situation like this.  
0
 
LVL 65

Accepted Solution

by:
rockiroads earned 2000 total points
ID: 24197617
your right, RunCode expects functions

change "public sub" to "public function"  ("end sub" should change to "end function")
remember to test on dummy db and you have to restart db to see changes
0
 

Author Comment

by:bmav25
ID: 24197807
That seems to have worked, but the bypass key isn't allowing a bypass of the autoexec.  It only allows a view of the access objects on the left, but you can't edit them.  Will the bypass key not work in this case?

Also, the toolbar at the top is still visible but most buttons are disabled.  I am assuming there is another property to be changed.
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 24198172
do you mean the shift bypass? I find that sometims I have to try it a few times before I get in and see everything

regarding toolbar at top, I thought AllowBuiltinToolbars would of handled that. I dont know if it has anything to do with how ribbons work in A2007
0
 

Author Comment

by:bmav25
ID: 24199162
Yes, I was talking about the shift bypass.  I will give it a couple more tries.  

In terms of the toolbar, I will look into a different property or alternate way of disabling it.  If all else fails, I can just manually disable it.

Thanks for all your help.
0

Featured Post

Independent Software Vendors: 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

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

834 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