Solved

Access 2010 Macro

Posted on 2014-03-26
8
795 Views
Last Modified: 2014-03-28
Hi

Still learning to use Access 2010 no problem with 2003.
Macros
I want to add two lines to a 2010 Macro RunCode and HideRibbon(). I have added the line HideRibbon() but can't seem to be able to edit and Add the line RunCode.
Any help appreciated

chestera
0
Comment
Question by:chestera
  • 4
  • 4
8 Comments
 
LVL 61

Expert Comment

by:mbizup
Comment Utility
Can you post a sample copy of your database?

RunCode is definitely an option in Access 2010 accdb/mdb file.

(Guessing that it is NOT an option in Web Projects, however)
0
 

Author Comment

by:chestera
Comment Utility
mbizup

I have been doing some research and have bypassed the autoexec and put the following code in my startup  form
docmd.showtoolbar "Ribbon", acToolbarNo. this works fine and is simple.

Alan
0
 
LVL 61

Expert Comment

by:mbizup
Comment Utility
VBA is my own preferred approach over Macros.  Glad you've got it worked out.

Curious what was going wrong with your macro though... it *should* work.  The general approach is to have a public function:

Public Function HideRibbon()
    docmd.showtoolbar "Ribbon", acToolbarNo
End Function

Open in new window


And then add a RunCode line to your autoExec Macro to call that function.

You do need the custom public function, since HideRibbon is not a native command, and it does need to be a function (not a sub).
0
 

Author Comment

by:chestera
Comment Utility
mbizup

My problem with the Macro I initially entered the Function call HideRibbon() but the I realized I hadn't enter the RunCode line and I didn't know how to add the line. Is there away to remove the Home Ribbon Menu when running the mde or aade rather than hide I have the old access2003 dropdown menu's and hidding the Home Ribbon leaves a large gap

Alan
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
Comment Utility
Alan,

For that, you would have to customize the Access ribbon, which is completely different from customizing the Access 2003/earlier command bars.

Ribbon customization is a huge topic, but to get you started...

Ribbons are XML based, and customization involves in its simplest form creating and customizing a dedicated table for the XML markup.  There are a couple of approaches - one is to start with the default Access Ribbon, and remove/hide what you don't need.  The other is to start fresh and *add* only what you need to the ribbon (which is probably the easiest way to do what you're asking).  For this approach, remember to use the "Start From Scratch" option in the XML.

The following should get you going in the right direction (or at least help you decide whether or not it is worth the effort).

A tool for customizing ribbons.  I cant vouch for this, but other regulars here love it.:
http://www.ribboncreator2010.de/en/

For a 'Do it Yourself' approach...
This is a thorough tutorial to get you started with basic ribbons:
http://office.microsoft.com/en-us/access-help/customize-the-ribbon-HA010211415.aspx

This covers just about everything you need to know about ribbons, and is a great resource (but best AFTER you have learned the basics of ribbon customization):
http://www.accessribbon.de/en/

Ribbon customization can be involved/complicated, but it is worth learning in the long run.
0
 

Author Comment

by:chestera
Comment Utility
mbizup

Thank you very much for all your help most appreciated

Alan
0
 
LVL 61

Expert Comment

by:mbizup
Comment Utility
Here is a sample that you can dig into  - an incomplete invoicing database, with a partially complete custom ribbon.

The main things to look into

- Table: USysRibbons --- You might need to set your copy of Access to show system objects to see this table

-  modRibbons -- Module of VBA callback functions that affect the ribbon

-  Code in the various forms (Open Events, if I remember correctly) that call those functions
DatabaseDevelopment.accdb
0
 

Author Comment

by:chestera
Comment Utility
mbizup

Thank you. I now have a wealth of info

All the best

Alan
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…

743 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

12 Experts available now in Live!

Get 1:1 Help Now