Adding Datasheet and Form view to custom ribbon

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" />
AnnetteDavidAsked:
Who is Participating?
 
peter57rConnect With a Mentor Commented:
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
 
peter57rCommented:
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
 
AnnetteDavidAuthor Commented:
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
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

 
peter57rCommented:
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
 
AnnetteDavidAuthor Commented:
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
 
peter57rCommented:
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
 
AnnetteDavidAuthor Commented:
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
 
AnnetteDavidAuthor Commented:
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
 
AnnetteDavidAuthor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.