A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Hide ribbon event not working



 
 
Thread Tools Display Modes
  #1  
Old June 4th, 2010, 05:46 PM posted to microsoft.public.access.forms
esn
external usenet poster
 
Posts: 34
Default Hide ribbon event not working

I'm terrible with VBA so this might be something really simple. In
Access 2007, I have a startup form with this event on load:

Private Sub Form_Load()
DoCmd.SelectObject acTable, , True
DoCmd.RunCommand acCmdWindowHide
DoCmd.ShowToolbar "Ribbon", acToolbarNo
End Sub

and this on close:

Private Sub Form_Close()
DoCmd.SelectObject acTable, , True
DoCmd.ShowToolbar "Ribbon", acToolbarYes
End Sub

I've also tried the first event as on open and there is no apparent
difference in functionality. I got the code from searching for ways
to hide the ribbon and navigation pane. These codes work perfectly
for the navigation pane but don't seem to affect the ribbon at all.
I've also tried splitting the first event up between on open and on
load (hiding the nav pane on open and the ribbon on load) but that
didn't work either. Any ideas on why hiding the ribbon isn't
working? I swear I've gotten this to work before, without having to
create a custom ribbon or anything, I just can't remember how.
Ads
  #2  
Old June 4th, 2010, 09:52 PM posted to microsoft.public.access.forms
Jörn Bosse
external usenet poster
 
Posts: 7
Default Hide ribbon event not working

Hi,

Hide Ribbon and menus:
DoCmd.ShowToolbar "Ribbon", acToolbarNo

Show Ribbon and menus:
DoCmd.ShowToolbar "Ribbon", acToolbarYes

Hide navigaionpanel:
DoCmd.SelectObject acTable, , True
RunCommand acCmdWindowHide

Show navigationpanel:
DoCmd.SelectObject acTable, , True


Regards
Jörn Bosse

Am 04.06.2010 18:46, schrieb esn:
I'm terrible with VBA so this might be something really simple. In
Access 2007, I have a startup form with this event on load:

Private Sub Form_Load()
DoCmd.SelectObject acTable, , True
DoCmd.RunCommand acCmdWindowHide
DoCmd.ShowToolbar "Ribbon", acToolbarNo
End Sub

and this on close:

Private Sub Form_Close()
DoCmd.SelectObject acTable, , True
DoCmd.ShowToolbar "Ribbon", acToolbarYes
End Sub

I've also tried the first event as on open and there is no apparent
difference in functionality. I got the code from searching for ways
to hide the ribbon and navigation pane. These codes work perfectly
for the navigation pane but don't seem to affect the ribbon at all.
I've also tried splitting the first event up between on open and on
load (hiding the nav pane on open and the ribbon on load) but that
didn't work either. Any ideas on why hiding the ribbon isn't
working? I swear I've gotten this to work before, without having to
create a custom ribbon or anything, I just can't remember how.


  #3  
Old June 4th, 2010, 10:15 PM posted to microsoft.public.access.forms
esn
external usenet poster
 
Posts: 34
Default Hide ribbon event not working

Hide Ribbon and menus:
DoCmd.ShowToolbar "Ribbon", acToolbarNo

Show Ribbon and menus:
DoCmd.ShowToolbar "Ribbon", acToolbarYes

Hide navigaionpanel:
DoCmd.SelectObject acTable, , True
* * *RunCommand acCmdWindowHide

Show navigationpanel:
DoCmd.SelectObject acTable, , True


Yeah so why isn't it working?
  #4  
Old June 4th, 2010, 10:35 PM posted to microsoft.public.access.forms
Jörn Bosse
external usenet poster
 
Posts: 7
Default Hide ribbon event not working

Am 04.06.2010 23:15, schrieb esn:
Hide Ribbon and menus:
DoCmd.ShowToolbar "Ribbon", acToolbarNo

Show Ribbon and menus:
DoCmd.ShowToolbar "Ribbon", acToolbarYes

Hide navigaionpanel:
DoCmd.SelectObject acTable, , True
RunCommand acCmdWindowHide

Show navigationpanel:
DoCmd.SelectObject acTable, , True


Yeah so why isn't it working?


Did you create a secure folder in the security center? Or do you always
have to choose "Allow Macros" or something like this, when your db starts?


  #5  
Old June 4th, 2010, 10:46 PM posted to microsoft.public.access.forms
esn
external usenet poster
 
Posts: 34
Default Hide ribbon event not working

Thanks for checking in again,

Did you create a secure folder in the security center? Or do you always
* have to choose "Allow Macros" or something like this, when your db starts?


The db is in a "trusted location," so events/macros aren't blocked,
plus I have my default setting at "allow all macros" because the only
db files I open are ones I built myself. Anything else it could be?
  #6  
Old June 4th, 2010, 11:04 PM posted to microsoft.public.access.forms
Jörn Bosse
external usenet poster
 
Posts: 7
Default Hide ribbon event not working

Well,

try to create a button which executes the code. I just checked ist and
it works fine. If that doesn´t hel, you may create a module with a
public function. Create a macro called autoexec which executes this
function.
You could show up a messagbox when loading your startform to check if
code is about to be executed on startup.

Jörn

Am 04.06.2010 23:46, schrieb esn:
Thanks for checking in again,

Did you create a secure folder in the security center? Or do you always
have to choose "Allow Macros" or something like this, when your db starts?


The db is in a "trusted location," so events/macros aren't blocked,
plus I have my default setting at "allow all macros" because the only
db files I open are ones I built myself. Anything else it could be?


  #7  
Old June 5th, 2010, 07:15 PM posted to microsoft.public.access.forms
esn
external usenet poster
 
Posts: 34
Default Hide ribbon event not working

On Jun 4, 3:04*pm, Jörn Bosse wrote:
Well,

try to create a button which executes the code. I just checked ist and
it works fine. If that doesn´t hel, you may create a module with a
public function. Create a macro called autoexec which executes this
function.
You could show up a messagbox when loading your startform to check if
code is about to be executed on startup.

Jörn

Am 04.06.2010 23:46, schrieb esn:

Thanks for checking in again,


Did you create a secure folder in the security center? Or do you always
* *have to choose "Allow Macros" or something like this, when your db starts?


The db is in a "trusted location," so events/macros aren't blocked,
plus I have my default setting at "allow all macros" because the only
db files I open are ones I built myself. *Anything else it could be?


I know the code is loading on startup because it hides the navigation
pane like it should. I tried putting the code in the on click event
of a button and it still doesn't do anything. I've pored over the
options and can't find anything that would be blocking this particular
line of code. Is there any chance I accidentally renamed the ribbon
or something like that?
  #8  
Old June 5th, 2010, 07:22 PM posted to microsoft.public.access.forms
esn
external usenet poster
 
Posts: 34
Default Hide ribbon event not working

On Jun 5, 11:15*am, esn wrote:
On Jun 4, 3:04*pm, Jörn Bosse wrote:



Well,


try to create a button which executes the code. I just checked ist and
it works fine. If that doesn´t hel, you may create a module with a
public function. Create a macro called autoexec which executes this
function.
You could show up a messagbox when loading your startform to check if
code is about to be executed on startup.


Jörn


Am 04.06.2010 23:46, schrieb esn:


Thanks for checking in again,


Did you create a secure folder in the security center? Or do you always
* *have to choose "Allow Macros" or something like this, when your db starts?


The db is in a "trusted location," so events/macros aren't blocked,
plus I have my default setting at "allow all macros" because the only
db files I open are ones I built myself. *Anything else it could be?


I know the code is loading on startup because it hides the navigation
pane like it should. *I tried putting the code in the on click event
of a button and it still doesn't do anything. *I've pored over the
options and can't find anything that would be blocking this particular
line of code. *Is there any chance I accidentally renamed the ribbon
or something like that?


Update - I tried putting it on a form in a completely empty blank
database and it does the trick. So why is the database I'm working on
not reading that particular line of code? I took a look at some of
the system tables to see if anything jumped out but that's all way
over my head.
  #9  
Old June 5th, 2010, 07:51 PM posted to microsoft.public.access.forms
esn
external usenet poster
 
Posts: 34
Default Hide ribbon event not working

I just remembered having a problem with the VBA references of a
previous database file. I had to go into the tools menu and de-select
a few references, close, reopen, and re-select the referenced
libraries. Any chance this is something similar - some sort of broken
object reference or something? I tried running through this process,
but Access wouldn't let me remove the first two references in the
list, since there are objects that depend on them. Could the problem
be in one of those? If so, what do I do to fix it?
  #10  
Old June 6th, 2010, 01:54 AM posted to microsoft.public.access.forms
Jörn Bosse
external usenet poster
 
Posts: 7
Default Hide ribbon event not working

If you didn´t disabled the VBA Project ref everything should work with
that code. You cant change the name of the Ribbon toolbar at all. Would
you please try that code in an other db?
If you want to, you can send me that db, via email but please with no
data inside. Then i can figure out whats wrong and not only suggesting
what it could be. This would be a lot faster.

Regards
Jörn


Am 05.06.2010 20:51, schrieb esn:
I just remembered having a problem with the VBA references of a
previous database file. I had to go into the tools menu and de-select
a few references, close, reopen, and re-select the referenced
libraries. Any chance this is something similar - some sort of broken
object reference or something? I tried running through this process,
but Access wouldn't let me remove the first two references in the
list, since there are objects that depend on them. Could the problem
be in one of those? If so, what do I do to fix it?


 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:53 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright ©2004-2017 OfficeFrustration.
The comments are property of their posters.