Solved

Access 2010 Autoexec problem

Posted on 2014-03-28
26
676 Views
Last Modified: 2014-04-05
Hi EE

I am having an Autoexec problem I have the following function
Public Function HideRibbon()
    DoCmd.ShowToolbar "Ribbon", acToolbarNo
End Function

 The Autoexec Macro as follows
RunCode
HideRibbon()

If I run Autoexec it works fine but wont work when I open the Application.
Am I doing something wrong

chestera
0
Comment
Question by:chestera
  • 13
  • 9
  • 2
  • +1
26 Comments
 
LVL 75
ID: 39963278
The Ribbon does not load until an AutoExec macro has completed, as I discovered a while back.

mx
0
 

Author Comment

by:chestera
ID: 39963346
DatabaseMax

So my function and Autoexec are correct what should I do

chestera
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 39963595
no points please.

Call the function from within the Open or Load event of your splash form (the first one that opens in you application.
0
 

Author Comment

by:chestera
ID: 39963651
fyed

I already tried that still not hiding the Ribbon. If I open the form within design mode it works
but not when I open the app itself

Alan
0
 
LVL 3

Expert Comment

by:Oliver Wastell
ID: 39963989
Hi Chestera,

I make ribbons disappear using the following method:

Create a table called 'USysRibbons' with the following two fields:
RibbonName (Text)
RibbonXml (Memo)

Now add to this table the following record:

RibbonName:
Standard

RibbonXml:
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
  <ribbon startFromScratch="true">
  </ribbon>
</customUI>

You will then need to close down and reopen the database before going into
Access Options > Current Database

Under the heading 'Ribbon and Toolbar Options', you'll see 'Ribbon Name:' with a combo box.  In this combo box select 'Standard'.

When you open the database next it will load the standard ribbon which is empty, so in fact you will see no ribbon.

You can then define other ribbons as you need in the 'USysRibbons' table.  For example I have a print preview ribbon defined.  In the design view for a report on the 'Other' Property Sheet you can select your ribbon in the Ribbon Name property (all ribbons defined in the USysRibbons table will appear in the drop down box).
0
 
LVL 3

Accepted Solution

by:
Oliver Wastell earned 500 total points
ID: 39963996
The Print Preview ribbon I use is defined in the USysRibbons table as follows:

RibbonName:
Print Preview

RibbonXML:
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
  <ribbon startFromScratch="true">
<tabs>
<tab id="tabPrintPreview" label="Printer">
<group id="grpPrint" label="Printer"  visible="true">
 <button idMso="PrintDialogAccess" size="large" label="Print" imageMso="PrintDialogAccess"/>
</group>
<group id="grpZoom" label="Zoom" >
<splitButton idMso="PrintPreviewZoomMenu" size="large" visible="true"/>
<toggleButton idMso="ZoomFitToWindow" size="large"/>
<toggleButton idMso="ZoomOnePage" size="large"/>
<toggleButton idMso="PrintPreviewZoomTwoPages" size="large"/>
 </group>
<group id="grpExport" label="Export"  visible="true">
<button id="ExpExc" label="Export to Excel" imageMso="ExportExcel" onAction="mcrRibbon.ManualExportToExcel" size="large"/>
</group>
<group id="grpClosePreview" label="Close Report"  visible="true">
<button idMso="PrintPreviewClose" size="large" label="Close" imageMso="PrintPreviewClose"/>
</group>
</tab>
</tabs>
  </ribbon>
</customUI>
0
 

Author Comment

by:chestera
ID: 39964273
odwastell

Many thanks for that bit of info I will now go and try it. My app is  written in Access 2003 If I open in 2010 and make an mde it works using the 2003 custom menu and removes the Ribbon toolbar. Not sure if using access 2003 under 2010 is a good idea but it works. I want to use 2010 and give 2003 away so need to know how to remove/Hide toolbar ribbon and design custom ribbons. Do you know any good books explaining creating custom menus in 2010

Alan
0
 
LVL 3

Expert Comment

by:Oliver Wastell
ID: 39964282
Hi Alan,

Wrox's: Microsoft Access 2010 Programmer's Reference by Teresa Hennig and others is an excellent book and has a chapter on customising the ribbon.  In fact it has lots of chapters on lots of different areas.  

I have a lot of clients running .mdb/.mde databases in Access 2007/2010 without issues.  However Access 2007+ has a lot going for it, especially when it comes to security.  Miles better.

Oliver
0
 

Author Comment

by:chestera
ID: 39964325
odwastell

Followed your instructions creating USysRibbons

If I have the data in design mode I can select Standard from the combo box. If I have the Font end in design mode and select the combo box it's empty.

I will try and get a copy of Wrox's: Microsoft Access 2010 Programmer's Reference by Teresa Hennig

Alan
0
 
LVL 3

Expert Comment

by:Oliver Wastell
ID: 39964328
Sorry, I should have said, the USysRibbons table goes in the front-end as the ribbons are part of the user interface.  You can leave a copy of the USysRibbons table in the backend if you also want to hide the ribbons there (or create ribbons that are specific to the backend only), but don't link to it from the front end file.

The USysRibbons table is a system table which MS Access looks out for.  It is used by the file within which it is placed.
0
 

Author Comment

by:chestera
ID: 39964333
odwastell

 I did put in the backend but for some reason I lost USysRibbbon it so re-cresated  and can now see standard from combo box in the font end put it's linked. I will remove to the front end. Putting in the front does make sense

Alan
0
 
LVL 3

Expert Comment

by:Oliver Wastell
ID: 39964336
In 'Navigation Options' (access by right clicking the top of the Navigation Pane) you'll need to check 'Show System Objects' otherwise tables starting USys will be hidden.
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

Author Comment

by:chestera
ID: 39964345
odwastell

Yep got that. I transferred USysRibbon to the frontend. Entered Standard as Ribbon Name and in RibbonXml entered  <customUI xmlns=etc>
I ran the app but the ribbon still there. The drop down menu I am using is quite extensive to transfer to custom Ribbons looks like it could cost more man hours then developing the App it self.

Alan
0
 
LVL 3

Expert Comment

by:Oliver Wastell
ID: 39964361
I'm happy to take a look at your database if you don't mind sharing, either upload here or email the zipped copy to [email removed by SouthMod]
(I'm just leaving the office now so it won't be until sometime tomorrow)

One last thought before I go for now, if you convert your file to the Access 2007 format and run it, does the ribbon disappear?
0
 
LVL 75
ID: 39964388
" either upload here or email the zipped copy to [email removed]"
Actually, EE rules do not allow emailing privately. You must upload to EE.

mx
0
 

Author Comment

by:chestera
ID: 39964389
odwastell

It's a very large Database with sensitive data. I will fire up 2007 and see how it goes.
I have been playing with my own version of a ribbon menu. On a splash form I have a few labels that I have customised to emulate Buttons the beauty of this is you can colour or put images on the lable to suit what it represents. Clicking a label opens a form or show more labels as sub menus very similar to MOYB. It also shows my original 2003 dropdown menu for those users that prefer that type of menu.

Alan
0
 

Author Comment

by:chestera
ID: 39964518
odwastell

Fired up 2007
Creating the USysRibbons table does the complete opposite to 2010.
It removes the Ribbon toolbar completely not leaving space to add custome ribbons and also my ADD-In 2003 menu. Bottom line in 2007 no menus just the splash screen

Alan
0
 

Author Comment

by:chestera
ID: 39964523
DatabaseMX

I wont be emailing a copy of my database it's very large with some sensitive stuff. I normally use access 2003 build my Databases with custom dropdown menus then use 2010 and make an mde. It's the current user would like a Ribbon type of menu and what I have learned in the last few days it's seems quite complex.

I have tried the "Docmd.ShowtoolBar "Ribbon", acToolBarNo" placed in a function using Call HideRibbon and also tried Autoexec macro

If I place "Docmd.ShowtoolBar "Ribbon", acToolBarNo in the open or load event of my splash form and run in design mode it works same with Autoexec Marcro run within design mode it works

running as mde accde it don't work

Appreciate your help

Alan
0
 

Author Comment

by:chestera
ID: 39965366
odwastell

Hi Oliver

I think we have gone as far as we can I have received a wealth of info from you to get me started. I downloaded a database called DatabaseDemonstration which has a very good example of how to create custom Ribbon and when run it works. Its the same methode you gave me and which I have added to my database so it should work I must have somthing not quite right. I ordered   that book by Teresa Henning. I really appreciate all you have done and thank you for your time

Alan
0
 

Author Comment

by:chestera
ID: 39965369
DatabaseMX

Hi MX

Thank you for your input. Oliver has given me all I need to know to get me started so will give him all the points

Alan
0
 
LVL 3

Expert Comment

by:Oliver Wastell
ID: 39965375
Hi Alan,

No trouble at all.  Good luck with the ribbons.

Oliver
0
 
LVL 3

Expert Comment

by:Oliver Wastell
ID: 39977513
Hi Alan,
I hope that you are well.  If you need any help on assigning the points, please let me know.
Many thanks,
Oliver
0
 

Author Comment

by:chestera
ID: 39979264
Oliver Wastell

Hi Oliver

I thought I closed this question and gave you the points but keep getting emails from EE.
If I haven't closed I Apologise .

Alan
0
 

Author Closing Comment

by:chestera
ID: 39979611
Oliver Wastell

Sorry for the delay thought I had awarded the points

Alan
0
 
LVL 3

Expert Comment

by:Oliver Wastell
ID: 39980140
No problem, thanks for the points and the grading.

Oliver
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

757 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now