Connecting Tech Pros Worldwide Help | Site Map

Startup, Tool Bars, Menu Bars, Shortcuts, DB Window, etc

cefrancke@yahoo.com
Guest
 
Posts: n/a
#1: Nov 13 '05
I cant seem to find a straight answer on the following.

I want to programmatically hide all menus except a basic custom report
menu (during report preview) and right click pop-up A-Z sorting on
datasheets (for subforms).

I would like to do this on startup of the application.

To be clear:

On Statup of the .mdb/mde file...

1. Hide the Access Splash screen.
2. Hide the DB window.
3. Disable all menus/toolbars etc.
4. Show the Main form.
5. Enable a popup menu on right clicking on datasheet views for AZ
sorting.
6. Enable, when reports are in preview, a toolbar for basic printing,
zoom and closing of report.

Please suggest the appropriate place to call the functionality,ie on
FormOpen, FormLoad, etc...

I would like to set as many features as I can with the 'Startup'
properties under the tools menu and then set the rest with programming.

My intent is to wrap the code in a if..then..else to allow
administrators full menus and other users just the limit features
described above.

Regards and TIA

Jeff Smith
Guest
 
Posts: n/a
#2: Nov 13 '05

re: Startup, Tool Bars, Menu Bars, Shortcuts, DB Window, etc


You can do all this without any programming at all.

1. Hide the splash screen: Create a .bmp file (MS Paint will do) that is 1
pixel by 1 pixel in size and save it with the same name as your application
and also in the same folder. C:\Databases\MyApp.mdb and
C:\Databases\MyApp.bmp.

2. Hide the DB Window: Tools>Startup and untick Display Database Window

3 - 5 Look at the Startup properties.

6. Create your own report tool bar (View>Toolbars>Customize) and in the
design view of each report, go to the 'Other' tab of the report's properties
and select the required toolbar (and menu bar to if you've also created a
custom menu). This can also be done for every form.

Jeff


<cefrancke@yahoo.com> wrote in message
news:1112298987.168572.160600@z14g2000cwz.googlegr oups.com...[color=blue]
> I cant seem to find a straight answer on the following.
>
> I want to programmatically hide all menus except a basic custom report
> menu (during report preview) and right click pop-up A-Z sorting on
> datasheets (for subforms).
>
> I would like to do this on startup of the application.
>
> To be clear:
>
> On Statup of the .mdb/mde file...
>
> 1. Hide the Access Splash screen.
> 2. Hide the DB window.
> 3. Disable all menus/toolbars etc.
> 4. Show the Main form.
> 5. Enable a popup menu on right clicking on datasheet views for AZ
> sorting.
> 6. Enable, when reports are in preview, a toolbar for basic printing,
> zoom and closing of report.
>
> Please suggest the appropriate place to call the functionality,ie on
> FormOpen, FormLoad, etc...
>
> I would like to set as many features as I can with the 'Startup'
> properties under the tools menu and then set the rest with programming.
>
> My intent is to wrap the code in a if..then..else to allow
> administrators full menus and other users just the limit features
> described above.
>
> Regards and TIA
>[/color]


lauren quantrell
Guest
 
Posts: n/a
#3: Nov 13 '05

re: Startup, Tool Bars, Menu Bars, Shortcuts, DB Window, etc


The way I do this is as follows:
In the application's startup options (Tools-Startup) under Display Form
enter the name of the form you want the user to see when the
application loads.

In that form's OnOpen event put =SetStartupOptions()

Also in the startup options uncheck the "Display Database Window." (You
can also do this from code and I have that if you need it.)

Create your own splash screen in Photoshop and name it the same name as
your application + .bmp (example MillionDollarApp.mdb,
MillionDollarApp.bmp) that way your custom spalsh screen will appear
instead of the Access splash screen.

Create a function named SetStartupOptions and paste it into a new code
module.

Function SetStartupOptions
On Error GoTo myErr
'Set startup options

'Microsoft Access options:
Application.SetOption "Confirm Record Changes", False
Application.SetOption "Confirm Document Deletions", False
Application.SetOption "Confirm Action Queries", False
Application.SetOption "Default Find/Replace Behavior", 1
Application.SetOption "Hyperlink Color", 12
Application.SetOption "Followed Hyperlink Color", 12
Application.SetOption "Behavior Entering Field", 2
Application.SetOption "Show Startup Dialog Box", False
Application.SetOption "Show Hidden Objects", False
Application.SetOption "Show Status Bar", False
Application.SetOption "Show Values Limit", 2000
Application.CommandBars.AdaptiveMenus = False
Application.Assistant.On = False

'Hide Toolbars:
DoCmd.ShowToolbar "Web", acToolbarNo
'hide more toolabrs as required

myExit:
Exit Function
myErr:
MsgBox Err.Number & "-" & Err.Description
Resume myExit
End Function

Create a custom toolbar named myReportToolbar and open it using:
DoCmd.ShowToolbar "myReportToolbar", acToolbarYes
on the OnOpen event of every report and close it on the onClose event
of every report using:
DoCmd.ShowToolbar "myReportToolbar", acToolbarNo

Create a custom menu bar that has only the sort commands named
DatasheetSortAZ and in the Menubar property under the "Other" tab put
"DatasheetSortAZ"



cefrancke@yahoo.com wrote:[color=blue]
> I cant seem to find a straight answer on the following.
>
> I want to programmatically hide all menus except a basic custom[/color]
report[color=blue]
> menu (during report preview) and right click pop-up A-Z sorting on
> datasheets (for subforms).
>
> I would like to do this on startup of the application.
>
> To be clear:
>
> On Statup of the .mdb/mde file...
>
> 1. Hide the Access Splash screen.
> 2. Hide the DB window.
> 3. Disable all menus/toolbars etc.
> 4. Show the Main form.
> 5. Enable a popup menu on right clicking on datasheet views for AZ
> sorting.
> 6. Enable, when reports are in preview, a toolbar for basic printing,
> zoom and closing of report.
>
> Please suggest the appropriate place to call the functionality,ie on
> FormOpen, FormLoad, etc...
>
> I would like to set as many features as I can with the 'Startup'
> properties under the tools menu and then set the rest with[/color]
programming.[color=blue]
>
> My intent is to wrap the code in a if..then..else to allow
> administrators full menus and other users just the limit features
> described above.
>
> Regards and TIA[/color]

Tim Marshall
Guest
 
Posts: n/a
#4: Nov 13 '05

re: Startup, Tool Bars, Menu Bars, Shortcuts, DB Window, etc


DIsclaimor: You need to be very, very careful. The fact that you're
asking these questions shows you are a very new Access user and some of
the following will get you into big problems if you're not familiar with
them, especially my info on menus, below.
[color=blue]
> On Statup of the .mdb/mde file...[/color]

Make sure there's a bmp or jpg with the same name in the same
directory/folder as the mdb/e:

MyApplication.mdb
MyApplication.jpg

MyApplication.jpg opens in place of the splash screen. I believe you
can make the image teeny tiny so as to be neglible in size or nearly
invisible.
[color=blue]
> 1. Hide the Access Splash screen.
> 2. Hide the DB window.
> 3. Disable all menus/toolbars etc.
> 4. Show the Main form.[/color]

See Tools->Startup...

Everthing you want is there.
[color=blue]
> 5. Enable a popup menu on right clicking on datasheet views for AZ
> sorting.[/color]

Use the Other properties of the form and controls and make sure Shortcut
Menu property is set to Yes and in the Shortcut Menu Bar property enter
the name of the short cut menu you want. See notes below on
[color=blue]
> 6. Enable, when reports are in preview, a toolbar for basic printing,
> zoom and closing of report.[/color]

See Toolbar property of the report in question.
[color=blue]
> I would like to set as many features as I can with the 'Startup'
> properties under the tools menu and then set the rest with programming.[/color]

[color=blue]
> My intent is to wrap the code in a if..then..else to allow
> administrators full menus and other users just the limit features
> described above.[/color]

Using the Commandbars collection works for this. In A97 and A2003
(dunno about others), the VBA intellisense does not completely support
the commandbars collection.

DON'T BOTHER TRYING TO ASSIGN A COMMANDBAR TO A VARIABLE, IE, DIM CB AS
COMMANDBAR. EXPLICITLY NAME THE COMMANDBAR (custom menu) IN YOUR CODE.

Some examples (air code):

Commandbars("mnuName").Visible = true/false

Commandbars("mnuName").controls(2).enabled = false 'full menu item

Commandbars("mnuName").controls(2).controls(3).ena bled = false 'submenu item

Commandbars("mnuName").controls(2).state = true/false 'state is useful
for check marks on and off.

Commandbars("mnuName").controls(2).caption = "hi"

Visible properties work as well, but I don't recommend using them as
things can get confusing when you're setting up menus.

If you want to play with menus, remember they will only take a public
function, not a sub. You can copy menu items in the custom menu mode by
holding ctrl and dragging menu items. BE VERY CAREFUL OF THIS AS YOU
CAN SHAG UP YOUR SYSTEM MENUS. For example, I often use the compact and
repair menu item as an item in my custom menus by ctrl-dragging it to
one of my custom toolbars. For the love of all that's holy, don't
forget the ctrl key here or in another mdb you're working on your
compact and repair menu item will have disappeared.




--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
cefrancke@yahoo.com
Guest
 
Posts: n/a
#5: Nov 13 '05

re: Startup, Tool Bars, Menu Bars, Shortcuts, DB Window, etc


Thanks everyone,

I created a custom spash screen.
Is there a way to have all of Access minimized, showing just the splash
or even hold the splash up long enough for the user to view company
info or contact info, and then after a specified time or when the form
is ready, maximize the app/MainForm?

On the report menu, I created a custom menu. For each report, I have a
sub report used as a report header. In the header code, FormOpen, I set
the parent report (the main report that was opened) toolbar to the
custom toolbar. Everythings works ok. When I close the report the
toolbar vanishes. Everything ok.
This way, I dont have to set the property in every report. Just make
sure I insert the main report subreport header

Still working on the 'context menu' (the popup menu, when right
clicking on a datasheet).
I have an unbound main form with tabs and a datasheet/form on each tab.
I hope I can set the context menu on the main form and it will apply to
the sub forms on the tab pages. Any comments?


I want to have in my startup code something like this...

If Admin then
Show all the built-in Access tool bars, menus etc.
else 'For non-admins
Hide all the built-in Access tool bars, menus, etc.
Show and enable, where appropriate, custom menus/tbs or maybe even a
built-in menu/tb
endif

I tend to get synchronicity issues with setting the
tools|options|startup.
For the db window, I can set to hide it in the startup options and
display it programatically with no problems.
The problem is when setting all the other items in the startup options,
"Show Menubars.." etc, I cant seem to get them to appear when the Admin
code is run. Any comments?
Will I have to leave the startup items on and then set them
programatically? or am I missing something?


If I can get this right, I can disable the infamous "Shift Key" on
startup, and the Access app can tell if the user is Admin or common
user and set everything else programmatically.

TIA

Tim Marshall
Guest
 
Posts: n/a
#6: Nov 13 '05

re: Startup, Tool Bars, Menu Bars, Shortcuts, DB Window, etc


cefrancke@yahoo.com wrote:
[color=blue]
> I created a custom spash screen.
> Is there a way to have all of Access minimized, showing just the splash
> or even hold the splash up long enough for the user to view company
> info or contact info, and then after a specified time or when the form
> is ready, maximize the app/MainForm?[/color]

The splash screen, ie, the opening image instead of the Access logo is
only momentary, depending on how quickly Access loads.

Much better to have your opening form do the sort of thing you've
described. You can call the opening form any time with an "About my
App" type of menu item, (similar to "About Access") in a custom menu.

You can have a "Continue" button on the splash form and/or (I usually
have both) a timer event limit how long the splash form stays open
before it closes and then opens a menu or other navigation form. If you
want the splash form to double as an "about" form, like I usually do,
have the calling function with an openarg:

DoCmd.OpenForm "frmSplash", acNormal, , , , , "About"

(whether you use acdialog or give the forma pop up property is something
you'll have to work out yourself).

In the on open event, have:

if me.openargs = "About" then me.timerinterval = 0

Which will set the timer interval to 0 and disable the timer event.
Users will need to press the button to kill the splash form.

I often do some primitive animation in my splash form by using the timer
event and playing with the top and left properties of various image or
other controls. For example on a parking meter maintenance program, I
have an image of a car drive up to a parking meter and knock it over...
a random function will occasionally make the car visible property =
false and an image of a Rhino or a Tank will replace it, say every one
in ten times or something like that. Just a bit of fun. Others usually
have a dancing cow (my personal symbol - timer event and random function
moving the image to various points of the screen).

In such cases, the if statement mentioned above is actually in the timer
event so that the docmd.close for the splash form is only fired if there
is no openarg for the form.

--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
cefrancke@yahoo.com
Guest
 
Posts: n/a
#7: Nov 13 '05

re: Startup, Tool Bars, Menu Bars, Shortcuts, DB Window, etc


Thanks Tim,
After my post, I had researched and ventured just as you suggested.
I created a separate "Splash" form and used a timer. I like the "About"
suggestion and the random animation.
Truely it is very fun at that point!

There is still some delay with the default menus and tb's on slower
machines.
I have the luxury of testing it on more sluggish machines. I figure if
I can speed things up on those, I've got it going fast.

Still having sync trouble with startup options. How can I return the
default menus/tbs for admin users?
Right now my approach is to set all the startup options to off. Then I
would like to return to all default state if admin otherwise
leave menu/tb state alone. Any ideas on an approach?

TIA

Tim Marshall
Guest
 
Posts: n/a
#8: Nov 13 '05

re: Startup, Tool Bars, Menu Bars, Shortcuts, DB Window, etc


cefrancke@yahoo.com wrote:
[color=blue]
> There is still some delay with the default menus and tb's on slower
> machines.[/color]

Yes, even if you have a menu bar specified in the start up there is
still a bit of delay sometimes.
[color=blue]
> Still having sync trouble with startup options. How can I return the
> default menus/tbs for admin users?
> Right now my approach is to set all the startup options to off. Then I
> would like to return to all default state if admin otherwise
> leave menu/tb state alone. Any ideas on an approach?[/color]

I wouldn't let admin users have access to default menus unless these
"admin users" are developers, like you.

Otherwise, are you using security? If you havent played with it before,
and are still an Access newbie, it can be quite overwhelming and there
are a lot of things to consider and it is easy to mess it up.

If you are using security, you can use the currenbtuser property instead
of what I will mention below.

To distinguish who is using the machine, you can retrieve the windows
log on name. See http://www.mvps.org/access/api/api0008.htm for
function fOsUserName().

I would then, in the on open event of your splash form run through all
your custom menus and disable/enable various choices.

Say you have tool bars, "tbr1" and "tbr2" and network user "sam" and
"lisa" are application administrators (as opposed to developers).

Throw this in (air code):

dim strUser as string

struser = fOsUserName 'the function for network user name

select case struser

case "lisa", "sam"

commandbars("tbr1").controls(2).enabled = true
commandbars("tbr1").controls(3).controls(3).enable d = true
commandbars("tbr1").controls(3).controls(4).enable d = true

case else 'all others who are not admins

commandbars("tbr1").controls(2).enabled = false
commandbars("tbr1").controls(3).controls(3).enable d = false
commandbars("tbr1").controls(3).controls(4).enable d = false

end select
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Closed Thread


Similar Microsoft Access / VBA bytes