PC Review


Reply
Thread Tools Rate Thread

Custom MenuBar

 
 
Secret Squirrel
Guest
Posts: n/a
 
      14th Nov 2008
I'm having a brain freeze with setting up my custom menubar. I have 2 menus
bars, 1 for all users (CustomMenu), and 1 for me (CustomMenuLS). I have the
following code firing via my autoexec macro but for some reason it's loading
the DB without any menubar. From the startup options I have the "CustomMenu"
loading as the default menubar. Am I doing something wrong here? How do I get
my menubar to load when I login and the other to load whenever someone else
logs in?

Public Function CustomLoad()

If CurrentUser() = "squirrel" Then
DoCmd.ShowToolbar "CustomMenu", acToolbarNo
Else
DoCmd.ShowToolbar "CustomMenuLS", acToolbarYes
End If

End Function
 
Reply With Quote
 
 
 
 
Arvin Meyer [MVP]
Guest
Posts: n/a
 
      14th Nov 2008
CurrentUser() is only available if you have user-level security enabled, and
have set it up. You can also grab the windows login name:

http://www.mvps.org/access/api/api0008.htm

and use that to run your code.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


"Secret Squirrel" <(E-Mail Removed)> wrote in
message news:945816B5-EF0C-4F66-A6B5-(E-Mail Removed)...
> I'm having a brain freeze with setting up my custom menubar. I have 2
> menus
> bars, 1 for all users (CustomMenu), and 1 for me (CustomMenuLS). I have
> the
> following code firing via my autoexec macro but for some reason it's
> loading
> the DB without any menubar. From the startup options I have the
> "CustomMenu"
> loading as the default menubar. Am I doing something wrong here? How do I
> get
> my menubar to load when I login and the other to load whenever someone
> else
> logs in?
>
> Public Function CustomLoad()
>
> If CurrentUser() = "squirrel" Then
> DoCmd.ShowToolbar "CustomMenu", acToolbarNo
> Else
> DoCmd.ShowToolbar "CustomMenuLS", acToolbarYes
> End If
>
> End Function



 
Reply With Quote
 
Dale Fye
Guest
Posts: n/a
 
      14th Nov 2008
I use the windows user name, as mentioned by Arvin. My guess is that your
windows username is not squirrel, but if it is, maybe this will do what you
want. Otherwise, just change "squirrel" to your username.

How about:

Public Function CustomLoad()

If fOSUserName() = "squirrel" Then
DoCmd.ShowToolbar "CustomMenu", acToolbarNo
DoCmd.ShowToolbar "CustomMenuLS", acToolbarYes
Else
DoCmd.ShowToolbar "CustomMenu", acToolbarYes
DoCmd.ShowToolbar "CustomMenuLS", acToolbarNo
End If

End Function
--
HTH
Dale

email address is invalid
Please reply to newsgroup only.



"Secret Squirrel" wrote:

> I'm having a brain freeze with setting up my custom menubar. I have 2 menus
> bars, 1 for all users (CustomMenu), and 1 for me (CustomMenuLS). I have the
> following code firing via my autoexec macro but for some reason it's loading
> the DB without any menubar. From the startup options I have the "CustomMenu"
> loading as the default menubar. Am I doing something wrong here? How do I get
> my menubar to load when I login and the other to load whenever someone else
> logs in?
>
> Public Function CustomLoad()
>
> If CurrentUser() = "squirrel" Then
> DoCmd.ShowToolbar "CustomMenu", acToolbarNo
> Else
> DoCmd.ShowToolbar "CustomMenuLS", acToolbarYes
> End If
>
> End Function

 
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
Custom Menubar =?Utf-8?B?QnJldA==?= Microsoft Excel Misc 1 19th Aug 2007 11:52 PM
Re: Code for setting Forms to open with custom tool bar, menubar and control custom short Rick Brandt Microsoft Access 0 5th Feb 2006 01:06 PM
Custom Menubar =?Utf-8?B?VGltVA==?= Microsoft Access 6 16th Dec 2005 03:13 PM
Re: Custom Menubar P Microsoft Access Form Coding 1 30th Jul 2003 01:42 PM
Re: Custom Menubar P Microsoft Access Forms 1 30th Jul 2003 01:42 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:30 AM.