AnnetteDavid
asked on
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="OpenLearnersForm View" getVisible="GetVisible" getEnabled="GetEnabled" />
<button id="btnShowFormView1" label="Learners Form View" size="large" imageMso="ViewsFormView" onAction="OpenLearnersForm
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.
ASKER
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
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)
ASKER
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:= ;CustomPic ture:=;Cus tomPicture Path:=" onAction="mcrmenu" getVisible="GetVisible" getEnabled="GetEnabled" />
<button id="btnEmail" size="large" label="Email" imageMso="AttachItem" tag="RibbonName:=;inMenu:= ;CustomPic ture:=;Cus tomPicture Path:=" onAction="mcrEmail" getVisible="GetVisible" getEnabled="GetEnabled" />
<button id="btnExcelfrom" size="large" label="Export to Excel" imageMso="ExportExcel" tag="RibbonName:=;inMenu:= ;CustomPic ture:=;Cus tomPicture Path:=" onAction="mcrexporttoexcel " getVisible="GetVisible" getEnabled="GetEnabled" />
<button id="btnPreview" size="large" label="Preview" imageMso="FilePrintPreview " tag="RibbonName:=;inMenu:= ;CustomPic ture:=;Cus tomPicture Path:=" onAction="mcrPreview" getVisible="GetVisible" getEnabled="GetEnabled" />
<button id="btnPrint" size="large" label="Print" imageMso="FilePrint" tag="RibbonName:=;inMenu:= ;CustomPic ture:=;Cus tomPicture Path:=" onAction="mcrPrint" getVisible="GetVisible" getEnabled="GetEnabled" />
<button id="btnPrintCards" size="large" label="Print All Student Cards" imageMso="FilePrint" tag="RibbonName:=;inMenu:= ;CustomPic ture:=;Cus tomPicture Path:=" onAction="mcrPrintAllStude ntCard" getVisible="GetVisible" getEnabled="GetEnabled" />
<button id="btnClose" size="large" label="Close" imageMso="GroupColorModeCl ose" tag="RibbonName:=;inMenu:= ;CustomPic ture:=;Cus tomPicture Path:=" onAction="mcrClose" getVisible="GetVisible" getEnabled="GetEnabled" />
<button id="btnShowFormView1" label="Learners Form View" size="large" imageMso="ViewsFormView" onAction="OpenLearnersForm View" getVisible="GetVisible" getEnabled="GetEnabled" />
<button id="btnShowDatasheet1" label="Learners Datasheet View" size="large" imageMso="AccessFormDatash eet" onAction="OpenLearnersData SheetView" getVisible="GetVisible" getEnabled="GetEnabled" />
</group>
<group id="grpRecords" label="Records" getVisible ="GetVisible">
<button id="btnFind" size="large" label="Find" imageMso="FindDialog" tag="RibbonName:=;inMenu:= ;CustomPic ture:=;Cus tomPicture Path:=" onAction="mcrFind" getVisible="GetVisible" getEnabled="GetEnabled" />
<button id="btnFilter" size="large" label="Filter by selection" imageMso="AdpDiagramIndexe sKeys" tag="RibbonName:=;inMenu:= ;CustomPic ture:=;Cus tomPicture Path:=" onAction="mcrFiltered" getVisible="GetVisible" getEnabled="GetEnabled" />
<button id="btnRefresh" size="large" label="Refresh" imageMso="DataRefreshAll" tag="RibbonName:=;inMenu:= ;CustomPic ture:=;Cus tomPicture Path:=" onAction="mcrRefresh" getVisible="GetVisible" getEnabled="GetEnabled" />
<menu id="mnuFilter" size="large" itemSize="normal" label="Filter" tag="RibbonName:=;inMenu:= ;CustomPic ture:=;Cus tomPicture Path:=" getVisible="GetVisible" getEnabled="GetEnabled" >
<menu id="mnuFilterBySelection00 0" itemSize="normal" label="Filter By Selection" tag="RibbonName:=IDBERibbo nCreator;i nMenu:=mnu Filter;Cus tomPicture :=;CustomP icturePath :=" getVisible="GetVisible" getEnabled="GetEnabled" >
<button id="btnA_Z" label="A-Z" tag="RibbonName:=IDBERibbo nCreator;i nMenu:=mnu FilterBySe lection000 ;CustomPic ture:=;Cus tomPicture Path:=" onAction="mcrfilter" getVisible="GetVisible" getEnabled="GetEnabled" />
<button id="btnZ_A" label="Z-A" tag="RibbonName:=IDBERibbo nCreator;i nMenu:=mnu FilterBySe lection000 ;CustomPic ture:=;Cus tomPicture Path:=" 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:= ;CustomPic ture:=;Cus tomPicture Path:=" onAction="AdminReports" getVisible="GetVisible" getEnabled="GetEnabled" />
<button id="btnHR" size="large" label="HR" imageMso="CreateReport" tag="RibbonName:=;inMenu:= ;CustomPic ture:=;Cus tomPicture Path:=" onAction="HrReports" getVisible="GetVisible" getEnabled="GetEnabled" />
<button id="btnClients" size="large" label="Clients" imageMso="CreateReport" tag="RibbonName:=;inMenu:= ;CustomPic ture:=;Cus tomPicture Path:=" onAction="ClientReports" getVisible="GetVisible" getEnabled="GetEnabled" />
<button id="btnEvents" size="large" label="Training Events" imageMso="CreateReport" tag="RibbonName:=;inMenu:= ;CustomPic ture:=;Cus tomPicture Path:=" onAction="TrainingEventRep orts" getVisible="GetVisible" getEnabled="GetEnabled" />
<button id="btnLearners" size="large" label="Learners" imageMso="CreateReport" tag="RibbonName:=;inMenu:= ;CustomPic ture:=;Cus tomPicture Path:=" onAction="LearnerReports" getVisible="GetVisible" getEnabled="GetEnabled" />
<button id="btnQualifications" size="large" label="Qualifications" imageMso="CreateReport" tag="RibbonName:=;inMenu:= ;CustomPic ture:=;Cus tomPicture Path:=" onAction="QualificationRep orts" getVisible="GetVisible" getEnabled="GetEnabled" />
<button id="btnSetas" size="large" label="Setas" imageMso="CreateReport" tag="RibbonName:=;inMenu:= ;CustomPic ture:=;Cus tomPicture Path:=" 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="FileBackupDataba se" tag="RibbonName:=;inMenu:= ;CustomPic ture:=;Cus tomPicture Path:=" onAction="Backup" getVisible="GetVisible" getEnabled="GetEnabled" />
<button id="btnLink" size="large" label="Link Tables" imageMso="DatabaseAccessBa ckEnd" tag="RibbonName:=;inMenu:= ;CustomPic ture:=;Cus tomPicture Path:=" onAction="mcrLinktable" getVisible="GetVisible" getEnabled="GetEnabled" />
<button id="btnArchive" size="large" label="Archive Old Learners" imageMso="RecordsDeleteRec ord" tag="RibbonName:=;inMenu:= ;CustomPic ture:=;Cus tomPicture Path:=" 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:= ;CustomPic ture:=;Cus tomPicture Path:=" onAction="UploadAgriInseta Form" getVisible="GetVisible" getEnabled="GetEnabled" />
<button id="btnUnitStd" size="large" label="Import Unit Standards" imageMso="ImportAccess" tag="RibbonName:=;inMenu:= ;CustomPic ture:=;Cus tomPicture Path:=" onAction="ImportLatestUnit Stds" getVisible="GetVisible" getEnabled="GetEnabled" />
<button id="btnExcel" size="large" label="Export To Excel" imageMso="ExportExcel" tag="RibbonName:=;inMenu:= ;CustomPic ture:=;Cus tomPicture Path:=" 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:= ;CustomPic ture:=;Cus tomPicture Path:=" onAction="mcrmaincompanyin fo" getVisible="GetVisible" getEnabled="GetEnabled" />
<button id="btnEmployeeinfo" size="large" label="Employee Info" imageMso="ExportAccess" tag="RibbonName:=;inMenu:= ;CustomPic ture:=;Cus tomPicture Path:=" onAction="mcrmainemployeei nfo" getVisible="GetVisible" getEnabled="GetEnabled" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>
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:=
<button id="btnEmail" size="large" label="Email" imageMso="AttachItem" tag="RibbonName:=;inMenu:=
<button id="btnExcelfrom" size="large" label="Export to Excel" imageMso="ExportExcel" tag="RibbonName:=;inMenu:=
<button id="btnPreview" size="large" label="Preview" imageMso="FilePrintPreview
<button id="btnPrint" size="large" label="Print" imageMso="FilePrint" tag="RibbonName:=;inMenu:=
<button id="btnPrintCards" size="large" label="Print All Student Cards" imageMso="FilePrint" tag="RibbonName:=;inMenu:=
<button id="btnClose" size="large" label="Close" imageMso="GroupColorModeCl
<button id="btnShowFormView1" label="Learners Form View" size="large" imageMso="ViewsFormView" onAction="OpenLearnersForm
<button id="btnShowDatasheet1" label="Learners Datasheet View" size="large" imageMso="AccessFormDatash
</group>
<group id="grpRecords" label="Records" getVisible ="GetVisible">
<button id="btnFind" size="large" label="Find" imageMso="FindDialog" tag="RibbonName:=;inMenu:=
<button id="btnFilter" size="large" label="Filter by selection" imageMso="AdpDiagramIndexe
<button id="btnRefresh" size="large" label="Refresh" imageMso="DataRefreshAll" tag="RibbonName:=;inMenu:=
<menu id="mnuFilter" size="large" itemSize="normal" label="Filter" tag="RibbonName:=;inMenu:=
<menu id="mnuFilterBySelection00
<button id="btnA_Z" label="A-Z" tag="RibbonName:=IDBERibbo
<button id="btnZ_A" label="Z-A" tag="RibbonName:=IDBERibbo
</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:=
<button id="btnHR" size="large" label="HR" imageMso="CreateReport" tag="RibbonName:=;inMenu:=
<button id="btnClients" size="large" label="Clients" imageMso="CreateReport" tag="RibbonName:=;inMenu:=
<button id="btnEvents" size="large" label="Training Events" imageMso="CreateReport" tag="RibbonName:=;inMenu:=
<button id="btnLearners" size="large" label="Learners" imageMso="CreateReport" tag="RibbonName:=;inMenu:=
<button id="btnQualifications" size="large" label="Qualifications" imageMso="CreateReport" tag="RibbonName:=;inMenu:=
<button id="btnSetas" size="large" label="Setas" imageMso="CreateReport" tag="RibbonName:=;inMenu:=
</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="FileBackupDataba
<button id="btnLink" size="large" label="Link Tables" imageMso="DatabaseAccessBa
<button id="btnArchive" size="large" label="Archive Old Learners" imageMso="RecordsDeleteRec
</group>
<group id="grpUploads" label="Loading" getVisible ="GetVisible">
<button id="btnSeta" size="large" label="Seta Exports" imageMso="ExportAccess" tag="RibbonName:=;inMenu:=
<button id="btnUnitStd" size="large" label="Import Unit Standards" imageMso="ImportAccess" tag="RibbonName:=;inMenu:=
<button id="btnExcel" size="large" label="Export To Excel" imageMso="ExportExcel" tag="RibbonName:=;inMenu:=
</group>
<group id="grpCompanyInfo" label="Update" getVisible ="GetVisible">
<button id="btncompanyinfo" size="large" label="Company Info" imageMso="ExportAccess" tag="RibbonName:=;inMenu:=
<button id="btnEmployeeinfo" size="large" label="Employee Info" imageMso="ExportAccess" tag="RibbonName:=;inMenu:=
</group>
</tab>
</tabs>
</ribbon>
</customUI>
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.
File>options>Customize Ribbon will give you a dialog box which lets you add any standard feature to a ribbon.
ASKER
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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
ASKER
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.