Solved

Adding Datasheet and Form view to custom ribbon

Posted on 2011-09-12
9
856 Views
Last Modified: 2012-05-12
Hi, I am adding two buttons to custom ribbons and need some help please.  I have (through kind help from Experts Exchange) got the correct icons for datasheet and formview onto the ribbons, but I want to add the code without having to have the name of the form.  So that the icons can be used with any of the forms.  At present I have it working perfectly with a macro behind it that tells it to open a particular form but that wont do for all forms.  Unforunatly I dont know a lot of code but I can manage bits and pieces.  Any help with Datasheet and Formview would be appreicated or a toggle would be brilliant.  At present I have the following code on my ribbon -

<button id="btnShowFormView1" label="Learners Form View" size="large" imageMso="ViewsFormView" onAction="OpenLearnersFormView" getVisible="GetVisible" getEnabled="GetEnabled" />
0
Comment
Question by:AnnetteDavid
  • 5
  • 4
9 Comments
 
LVL 77

Expert Comment

by:peter57r
Comment Utility
Can you explain why this was ever required as Access already has menu/ribbon options to switch between views for the active form, as I'm sure you must know.
0
 

Author Comment

by:AnnetteDavid
Comment Utility
Thanks for your reply, the person who was working on this built his own ribbons which really suited the database perfectly but I just wanted to add two more buttons, is this possible
0
 
LVL 77

Expert Comment

by:peter57r
Comment Utility
Well it's going to depend on how the previous developer produced the custom ribbon and on which version of Access you are using.  So Version first please? (if it's not A2010 I shall be dropping out of this Q)

0
 

Author Comment

by:AnnetteDavid
Comment Utility
Using this in Access 2010 but first developed in 2007, code is below.

Thanks so much for trying to help.

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" onLoad="OnRibbonLoad" loadImage="LoadImages">
  <ribbon startFromScratch="true">
    <tabs>
      <tab id="tabVirtualIT" label="Virtual-IT" getVisible ="GetVisible">
        <group id="grpOperations" label="Operations" getVisible ="GetVisible">
      <button id="btnHome" size="large" label="Virtual-IT Menu" imageMso="BlogHomePage" tag="RibbonName:=;inMenu:=;CustomPicture:=;CustomPicturePath:=" onAction="mcrmenu" getVisible="GetVisible" getEnabled="GetEnabled" />
        <button id="btnEmail" size="large" label="Email" imageMso="AttachItem" tag="RibbonName:=;inMenu:=;CustomPicture:=;CustomPicturePath:=" onAction="mcrEmail" getVisible="GetVisible" getEnabled="GetEnabled" />
      <button id="btnExcelfrom" size="large" label="Export to Excel" imageMso="ExportExcel" tag="RibbonName:=;inMenu:=;CustomPicture:=;CustomPicturePath:=" onAction="mcrexporttoexcel" getVisible="GetVisible" getEnabled="GetEnabled" />            
       <button id="btnPreview" size="large" label="Preview" imageMso="FilePrintPreview" tag="RibbonName:=;inMenu:=;CustomPicture:=;CustomPicturePath:=" onAction="mcrPreview" getVisible="GetVisible" getEnabled="GetEnabled" />
         <button id="btnPrint" size="large" label="Print" imageMso="FilePrint" tag="RibbonName:=;inMenu:=;CustomPicture:=;CustomPicturePath:=" onAction="mcrPrint" getVisible="GetVisible" getEnabled="GetEnabled" />
      <button id="btnPrintCards" size="large" label="Print All Student Cards" imageMso="FilePrint" tag="RibbonName:=;inMenu:=;CustomPicture:=;CustomPicturePath:=" onAction="mcrPrintAllStudentCard" getVisible="GetVisible" getEnabled="GetEnabled" />
<button id="btnClose" size="large" label="Close" imageMso="GroupColorModeClose" tag="RibbonName:=;inMenu:=;CustomPicture:=;CustomPicturePath:=" onAction="mcrClose" getVisible="GetVisible" getEnabled="GetEnabled" />

<button id="btnShowFormView1" label="Learners Form View" size="large" imageMso="ViewsFormView" onAction="OpenLearnersFormView" getVisible="GetVisible" getEnabled="GetEnabled" />

 <button id="btnShowDatasheet1" label="Learners Datasheet View" size="large" imageMso="AccessFormDatasheet"                  onAction="OpenLearnersDataSheetView" getVisible="GetVisible" getEnabled="GetEnabled" />

        </group>
        <group id="grpRecords" label="Records" getVisible ="GetVisible">
          <button id="btnFind" size="large" label="Find" imageMso="FindDialog" tag="RibbonName:=;inMenu:=;CustomPicture:=;CustomPicturePath:=" onAction="mcrFind" getVisible="GetVisible" getEnabled="GetEnabled" />
        <button id="btnFilter" size="large" label="Filter by selection" imageMso="AdpDiagramIndexesKeys" tag="RibbonName:=;inMenu:=;CustomPicture:=;CustomPicturePath:=" onAction="mcrFiltered" getVisible="GetVisible" getEnabled="GetEnabled" />
          <button id="btnRefresh" size="large" label="Refresh" imageMso="DataRefreshAll" tag="RibbonName:=;inMenu:=;CustomPicture:=;CustomPicturePath:=" onAction="mcrRefresh" getVisible="GetVisible" getEnabled="GetEnabled" />
          <menu id="mnuFilter" size="large" itemSize="normal" label="Filter" tag="RibbonName:=;inMenu:=;CustomPicture:=;CustomPicturePath:=" getVisible="GetVisible" getEnabled="GetEnabled" >
            <menu id="mnuFilterBySelection000" itemSize="normal" label="Filter By Selection" tag="RibbonName:=IDBERibbonCreator;inMenu:=mnuFilter;CustomPicture:=;CustomPicturePath:=" getVisible="GetVisible" getEnabled="GetEnabled" >
            <button id="btnA_Z" label="A-Z" tag="RibbonName:=IDBERibbonCreator;inMenu:=mnuFilterBySelection000;CustomPicture:=;CustomPicturePath:=" onAction="mcrfilter" getVisible="GetVisible" getEnabled="GetEnabled" />
            <button id="btnZ_A" label="Z-A" tag="RibbonName:=IDBERibbonCreator;inMenu:=mnuFilterBySelection000;CustomPicture:=;CustomPicturePath:=" onAction="mcrfilter" getVisible="GetVisible" getEnabled="GetEnabled" />
            </menu>
            <!--End menu (mnuFilterBySelection000) NOT delete this remark-->
          </menu>
          <!--End menu (mnuFilter) NOT delete this remark-->
        </group>
        <group id="grpReports" label="Reports" getVisible ="GetVisible">
      <button id="btnAdmin" size="large" label="Admin" imageMso="CreateReport" tag="RibbonName:=;inMenu:=;CustomPicture:=;CustomPicturePath:=" onAction="AdminReports" getVisible="GetVisible" getEnabled="GetEnabled" />
      <button id="btnHR" size="large" label="HR" imageMso="CreateReport" tag="RibbonName:=;inMenu:=;CustomPicture:=;CustomPicturePath:=" onAction="HrReports" getVisible="GetVisible" getEnabled="GetEnabled" />
      <button id="btnClients" size="large" label="Clients" imageMso="CreateReport" tag="RibbonName:=;inMenu:=;CustomPicture:=;CustomPicturePath:=" onAction="ClientReports" getVisible="GetVisible" getEnabled="GetEnabled" />
      <button id="btnEvents" size="large" label="Training Events" imageMso="CreateReport" tag="RibbonName:=;inMenu:=;CustomPicture:=;CustomPicturePath:=" onAction="TrainingEventReports" getVisible="GetVisible" getEnabled="GetEnabled" />
      <button id="btnLearners" size="large" label="Learners" imageMso="CreateReport" tag="RibbonName:=;inMenu:=;CustomPicture:=;CustomPicturePath:=" onAction="LearnerReports" getVisible="GetVisible" getEnabled="GetEnabled" />        
      <button id="btnQualifications" size="large" label="Qualifications" imageMso="CreateReport" tag="RibbonName:=;inMenu:=;CustomPicture:=;CustomPicturePath:=" onAction="QualificationReports" getVisible="GetVisible" getEnabled="GetEnabled" />
      <button id="btnSetas" size="large" label="Setas" imageMso="CreateReport" tag="RibbonName:=;inMenu:=;CustomPicture:=;CustomPicturePath:=" onAction="SETAReports" getVisible="GetVisible" getEnabled="GetEnabled" />
      </group>
      </tab>
      <tab id="tabAdministration" label="Administration" getVisible ="GetVisible">
      <group id="grpManage" label="Manage" getVisible ="GetVisible">
          <button id="btnBackUp" size="large" label="Back-UP" imageMso="FileBackupDatabase" tag="RibbonName:=;inMenu:=;CustomPicture:=;CustomPicturePath:=" onAction="Backup" getVisible="GetVisible" getEnabled="GetEnabled" />
          <button id="btnLink" size="large" label="Link Tables" imageMso="DatabaseAccessBackEnd" tag="RibbonName:=;inMenu:=;CustomPicture:=;CustomPicturePath:=" onAction="mcrLinktable" getVisible="GetVisible" getEnabled="GetEnabled" />
             <button id="btnArchive" size="large" label="Archive Old Learners" imageMso="RecordsDeleteRecord" tag="RibbonName:=;inMenu:=;CustomPicture:=;CustomPicturePath:=" onAction="ArchiveMacro" getVisible="GetVisible" getEnabled="GetEnabled" />
       </group>
      <group id="grpUploads" label="Loading" getVisible ="GetVisible">
          <button id="btnSeta" size="large" label="Seta Exports" imageMso="ExportAccess" tag="RibbonName:=;inMenu:=;CustomPicture:=;CustomPicturePath:=" onAction="UploadAgriInsetaForm" getVisible="GetVisible" getEnabled="GetEnabled" />
              <button id="btnUnitStd" size="large" label="Import Unit Standards" imageMso="ImportAccess" tag="RibbonName:=;inMenu:=;CustomPicture:=;CustomPicturePath:=" onAction="ImportLatestUnitStds" getVisible="GetVisible" getEnabled="GetEnabled" />
        <button id="btnExcel" size="large" label="Export To Excel" imageMso="ExportExcel" tag="RibbonName:=;inMenu:=;CustomPicture:=;CustomPicturePath:=" onAction="McrExportExcel" getVisible="GetVisible" getEnabled="GetEnabled" />
      </group>
      <group id="grpCompanyInfo" label="Update" getVisible ="GetVisible">
      <button id="btncompanyinfo" size="large" label="Company Info" imageMso="ExportAccess" tag="RibbonName:=;inMenu:=;CustomPicture:=;CustomPicturePath:=" onAction="mcrmaincompanyinfo" getVisible="GetVisible" getEnabled="GetEnabled" />
          <button id="btnEmployeeinfo" size="large" label="Employee Info" imageMso="ExportAccess" tag="RibbonName:=;inMenu:=;CustomPicture:=;CustomPicturePath:=" onAction="mcrmainemployeeinfo" getVisible="GetVisible" getEnabled="GetEnabled" />
      </group>
      </tab>
    </tabs>
  </ribbon>
</customUI>
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 77

Expert Comment

by:peter57r
Comment Utility
If you are using A2010, then you can add built-in options to any ribbon just using the ribbon editor.

File>options>Customize Ribbon  will give you a dialog box which lets you add any standard feature to a ribbon.
0
 

Author Comment

by:AnnetteDavid
Comment Utility
Hi thanks Peter, but this feature cannot see my own built in ribbons (just wish it was this easy).  Secondly if I was to use this feature and build everthing from scratch, cuold users who still have Access 2007 see the newly created ribbons
0
 
LVL 77

Accepted Solution

by:
peter57r earned 500 total points
Comment Utility
I thought this was going to be simple - and it should have been except that in testing I managed to make a small spelling mistake which i couldn't see and so I've been on a wild goose chase trying to find all sorts of explanations.

This is the basic code you need to add the view functions.

<group id="dbCustomGroup2" label="Another Custom Group">
          <control idMso="ViewsFormView" label="form view" enabled="true"/>
          <control idMso="ViewsDatasheetView" label="datasheetl" enabled="true"/>
        </group>

I suggest you start by adding it to your current XML just after the final <group/> and see what it looks like.

If necessary you can reposition it by cutting and pasting this code to any other corresponding position in the existing code.


Obviously I am unable to test this change with your code as your code is specific to your application.

0
 

Author Closing Comment

by:AnnetteDavid
Comment Utility
You are just the best, it works fantastically and just what I needed.  I cannot say thank you enough. If I could give you more than 500 points I would. Have a brilliant day
0
 

Author Comment

by:AnnetteDavid
Comment Utility
Hi Peter, I am going to add another question related to this one, thought I would let you know so you can get the points, dont want to take advantage.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

772 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

10 Experts available now in Live!

Get 1:1 Help Now