PC Review


Reply
Thread Tools Rating: Thread Rating: 9 votes, 3.22 average.

Setting the Startup Options for an Access 2007 database using VBA

 
 
genegal
Guest
Posts: n/a
 
      28th Jan 2010
Afternoon everyone,

I'm trying to use the information from an MSDN page of roughly the same
title (Setting Startup Options Programmatically in Access 2000,
http://msdn.microsoft.com/en-us/library/aa140020(office.10).aspx) to setup
the startup options of my database.

Firstly, I don't know whether this option should be placed in a module or
event (like Form_Load).

Secondly, I'm not too sure that I have the code correctly written down:

Private Sub Form_Load()

Dim dbs As CurrentProject

Set dbs = Application.CurrentProject

dbs.Properties.Remove "AllowShortcutMenus"
dbs.Properties.Remove "AllowBuiltInToolbars"
dbs.Properties.Remove "AllowBypassKey"
dbs.Properties.Remove "AllowFullMenus"

Set dbs = Nothing

End Sub

Is there anything that I'm missing?

Your help is much appreciated.

Gene
 
Reply With Quote
 
 
 
 
Douglas J. Steele
Guest
Posts: n/a
 
      28th Jan 2010
The startup options only need to be set once. I can't see any reason to put
it a form event.

--
Doug Steele, Microsoft Access MVP
http://www.AccessMVP.com/DJSteele
(no e-mails, please!)

"genegal" <(E-Mail Removed)> wrote in message
news(E-Mail Removed)...
> Afternoon everyone,
>
> I'm trying to use the information from an MSDN page of roughly the same
> title (Setting Startup Options Programmatically in Access 2000,
> http://msdn.microsoft.com/en-us/library/aa140020(office.10).aspx) to setup
> the startup options of my database.
>
> Firstly, I don't know whether this option should be placed in a module or
> event (like Form_Load).
>
> Secondly, I'm not too sure that I have the code correctly written down:
>
> Private Sub Form_Load()
>
> Dim dbs As CurrentProject
>
> Set dbs = Application.CurrentProject
>
> dbs.Properties.Remove "AllowShortcutMenus"
> dbs.Properties.Remove "AllowBuiltInToolbars"
> dbs.Properties.Remove "AllowBypassKey"
> dbs.Properties.Remove "AllowFullMenus"
>
> Set dbs = Nothing
>
> End Sub
>
> Is there anything that I'm missing?
>
> Your help is much appreciated.
>
> Gene



 
Reply With Quote
 
 
 
 
genegal
Guest
Posts: n/a
 
      28th Jan 2010
Maybe I didn't format my question properly:

I don't know HOW I'm supposed to declare the actions through VBA. Whether
it's supposed to be through a module, AutoExec macro, etc.

Furthermore, when I used the above code, I was given as error saying that no
property exists for such object, which clearly means that the code is wrong.
Just to serve as a reminder, this code was taken from an MSDN page for Access
2000 for .mdb database files, not Access 2007 (i.e. accdb) files.

Does anyone know if things might have changed since then? MSDN doesn't point
anything out in terms of changes or revisions for Access 2007. So there's
clearly something I'm not understanding.
 
Reply With Quote
 
genegal
Guest
Posts: n/a
 
      28th Jan 2010
Furthermore, I found this page:

http://msdn.microsoft.com/en-us/library/aa172335(office.11).aspx

Which pretty much has the same information, but is presented for Access
2003, but with no example. So it doesn't seem helpful at all.
 
Reply With Quote
 
Douglas J. Steele
Guest
Posts: n/a
 
      28th Jan 2010
Actually, given that there are no menus in Access 2007, I wouldn't expect
AllowShortcutMenus, AllowBuiltInToolbars or AllowFullMenus to be valid
properties anymore.

I know that the AllowBypassKey property doesn't exist unless you've created
it.


--
Doug Steele, Microsoft Access MVP
http://www.AccessMVP.com/DJSteele
(no e-mails, please!)

"genegal" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Maybe I didn't format my question properly:
>
> I don't know HOW I'm supposed to declare the actions through VBA. Whether
> it's supposed to be through a module, AutoExec macro, etc.
>
> Furthermore, when I used the above code, I was given as error saying that
> no
> property exists for such object, which clearly means that the code is
> wrong.
> Just to serve as a reminder, this code was taken from an MSDN page for
> Access
> 2000 for .mdb database files, not Access 2007 (i.e. accdb) files.
>
> Does anyone know if things might have changed since then? MSDN doesn't
> point
> anything out in terms of changes or revisions for Access 2007. So there's
> clearly something I'm not understanding.



 
Reply With Quote
 
Jack Leach
Guest
Posts: n/a
 
      28th Jan 2010
Some properties don't exist until they've been created. You'll notice that
in some code examples, objects are tested to see if they have a property
before setting it. You try to check the value of the object's property, trap
the error if one occurs, create the property if the error is that the
property doesn't exist, and then reroute your code back to the point where
you set it.

Is there some reason you can't set these startup properties once in a
template db? Generally startup properties don't get changed after they're
set.

hth

--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)



"genegal" wrote:

> Maybe I didn't format my question properly:
>
> I don't know HOW I'm supposed to declare the actions through VBA. Whether
> it's supposed to be through a module, AutoExec macro, etc.
>
> Furthermore, when I used the above code, I was given as error saying that no
> property exists for such object, which clearly means that the code is wrong.
> Just to serve as a reminder, this code was taken from an MSDN page for Access
> 2000 for .mdb database files, not Access 2007 (i.e. accdb) files.
>
> Does anyone know if things might have changed since then? MSDN doesn't point
> anything out in terms of changes or revisions for Access 2007. So there's
> clearly something I'm not understanding.

 
Reply With Quote
 
genegal
Guest
Posts: n/a
 
      29th Jan 2010
Thanks JimBurke for your input, but I've already set those properties
(Application.SetOption) without a problem. It's the database options that
seem to be problematic.
 
Reply With Quote
 
genegal
Guest
Posts: n/a
 
      29th Jan 2010
Assuming what you say is the case, then could you possibly show me an example
of where I have to declare properties and trap errors?

I just don't see this as a possible solution, because if I have to go as far
as trapping errors and declaring properties, it appears clear to me that VBA
doesn't have an immediate reference... Is there no way to tell VBA to look
for the Access options and disable them from there?

For example, "Allow Full Menus" (or ribbon menus in ACC2007) is located in
the Access options. So surely there must be some call that can be used to
'locate' the option and change it's condition (true/false) in one line,
without the need of error trapping?
 
Reply With Quote
 
Stuart McCall
Guest
Posts: n/a
 
      29th Jan 2010
"genegal" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Assuming what you say is the case, then could you possibly show me an
> example
> of where I have to declare properties and trap errors?
>
> I just don't see this as a possible solution, because if I have to go as
> far
> as trapping errors and declaring properties, it appears clear to me that
> VBA
> doesn't have an immediate reference... Is there no way to tell VBA to look
> for the Access options and disable them from there?
>
> For example, "Allow Full Menus" (or ribbon menus in ACC2007) is located in
> the Access options. So surely there must be some call that can be used to
> 'locate' the option and change it's condition (true/false) in one line,
> without the need of error trapping?


This is the best page I've seen on the subject:

http://msdn2.microsoft.com/en-us/library/aa172326(office.11).aspx


 
Reply With Quote
 
genegal
Guest
Posts: n/a
 
      29th Jan 2010
Thanks for the page link, but the link you provided me shows the options that
are set for the presentation of the database (what are called Global Options,
http://msdn.microsoft.com/en-us/library/aa140014(office.10).aspx), rather
than the security and integrity of the database (what are called Startup
Options, http://msdn.microsoft.com/en-us/library/aa140020(office.10).aspx).

I'm essentially looking for the Startup Options, which are basically the
settings that were mentioned in the first post.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using access to access an access database and an SQL database at t Henry Microsoft Access 7 26th Aug 2008 03:23 PM
HOW to Stop STartup Programs that do not show in the "startup" folder or have options in the programs to not start at windows startup james Windows Vista Installation 3 30th Jun 2008 01:22 AM
Access VBA - declared an Excel VBA reserved word and VBA/Access won't give it back! ultar6@gmail.com Microsoft Access 1 16th Jun 2007 05:11 AM
Tools,Options, Email Options, AdvancedE-mail Options, =?Utf-8?B?WWFrb3Y=?= Microsoft Outlook 4 5th Apr 2005 09:35 AM
Change the startup options in a database from a separate database =?Utf-8?B?U0hJUFA=?= Microsoft Access VBA Modules 0 9th Nov 2004 04:44 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:15 AM.