Form Controls

Leesha
BronzeLounger
Posts: 1488
Joined: 05 Feb 2010, 22:25

Form Controls

Post by Leesha »

Hi,

Is there a way to customize a database ribbon so that the only option that shows is the print ability? I can customize the ribbon on my laptop but I need to be sure that the same customization applies to anyone opening the database. Basically I only want the print options to be available.
Thanks,
Leesha

User avatar
HansV
Administrator
Posts: 78474
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Form Controls

Post by HansV »

You can create a custom ribbon that is stored in the database, so that it travels with it.
See Create a custom ribbon in Access.
Best wishes,
Hans

Leesha
BronzeLounger
Posts: 1488
Joined: 05 Feb 2010, 22:25

Re: Form Controls

Post by Leesha »

Thanks Hans! You are such a blessing!
Leesha

Leesha
BronzeLounger
Posts: 1488
Joined: 05 Feb 2010, 22:25

Re: Form Controls

Post by Leesha »

I'm getting 2 errors when opening the Database. Please see below.
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78474
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Form Controls

Post by HansV »

I hope that someone else can help you with this.
Best wishes,
Hans

Leesha
BronzeLounger
Posts: 1488
Joined: 05 Feb 2010, 22:25

Re: Form Controls

Post by Leesha »

Hi Hans,
I spent all day researching the errors I'm getting as well as xml and it is beyond me. While searching I did find an interesting video on on to turn off the ribbon in VBA using DoCmd.ShowToolbar "ribbon", acToolbarNo

I tried it and it does exactly what I want. The drawback is that it doesn't show the print controls for a report that is print preview. The video showed how to create another form that would turn ribbons on and off but I don't want to give the end user that capability. I only want them to have the ability Print a report from print preview. Have you got any ideas on how this code could be modified to allow the print controls but to disable the rest?

Thanks!
Leesha

User avatar
HansV
Administrator
Posts: 78474
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Form Controls

Post by HansV »

I have never done that kind of stuff, sorry.
Best wishes,
Hans

User avatar
SpeakEasy
4StarLounger
Posts: 550
Joined: 27 Jun 2021, 10:46

Re: Form Controls

Post by SpeakEasy »

The schema (what the error message is calling the namespace) is out of date. Try using

Code: Select all

http://schemas.microsoft.com/office/2009/07/customui

Leesha
BronzeLounger
Posts: 1488
Joined: 05 Feb 2010, 22:25

Re: Form Controls

Post by Leesha »

Hi Speakeasy,
I had found the one you referenced and it doesn't work either. If you go directly to the the site it gives the message "The resource you are looking for has been removed, had its name changed, or is temporarily unavailable."
Leesha

Leesha
BronzeLounger
Posts: 1488
Joined: 05 Feb 2010, 22:25

Re: Form Controls

Post by Leesha »

Thanks Hans!

User avatar
SpeakEasy
4StarLounger
Posts: 550
Joined: 27 Jun 2021, 10:46

Re: Form Controls

Post by SpeakEasy »

>it doesn't work either.

You won't want to hear this - but works absolutely fine here, I use it regularly for a couple of custom ribbons. Note that, despite its looks, It is not really a browsable URL (it is an XML namespace URI - universal resource identifier).

The following is a custom ribbon output I quickly created that gets close to what you want, if I have understood your requirements correctly. Works absolutely without problems here:

Code: Select all

<customUI xmlns='http://schemas.microsoft.com/office/2009/07/customui'>
  <ribbon startFromScratch='true'>
    <tabs>
      <tab idMso='TabPrintPreviewAccess' visible='true' />
    </tabs>
  </ribbon>
</customUI>
Note that one way of capturing correct XML for this sort of thing is to customise the ribbons the way you want through "Customise the Ribbon", 'OK' your changes, then reopen "Customise the Ribbon" and select Import/Export>Export all customizations this results in a file with XML in it that can then be used in the USysRibbons

Leesha
BronzeLounger
Posts: 1488
Joined: 05 Feb 2010, 22:25

Re: Form Controls

Post by Leesha »

Thank you SpeakEasy. This worked like a charm and I appreciate the tip! Two questions,

1. Does using a custom ribbon cancel out the use of a custom icon for the database? When I used this code DoCmd.ShowToolbar "ribbon", acToolbarNo the database opens with the custom icon in the upper left corner. With the customized ribbon it opens with the Access icon.
2. Is there any way to block the "File" tab/ribbon from showing? I only want the print preview that you've given me.

Thanks!
Leesha

User avatar
SpeakEasy
4StarLounger
Posts: 550
Joined: 27 Jun 2021, 10:46

Re: Form Controls

Post by SpeakEasy »

I'm afraid the file tab is a special case, and is essentially untouchable through ribbon customisation

Leesha
BronzeLounger
Posts: 1488
Joined: 05 Feb 2010, 22:25

Re: Form Controls

Post by Leesha »

HI SpeakEasy,
That is good to know! Is it the same case with the icon?
Thanks,
Leesha

User avatar
SpeakEasy
4StarLounger
Posts: 550
Joined: 27 Jun 2021, 10:46

Re: Form Controls

Post by SpeakEasy »

>Is it the same case with the icon?

Custom icon is working fine here, in as much as it is doing what I would expect. Perhaps you have different expectations.

Leesha
BronzeLounger
Posts: 1488
Joined: 05 Feb 2010, 22:25

Re: Form Controls

Post by Leesha »

OK will keep testing. It's probably me :-) Thanks!

User avatar
SpeakEasy
4StarLounger
Posts: 550
Joined: 27 Jun 2021, 10:46

Re: Form Controls

Post by SpeakEasy »

By the way, here's a slightly modified version of the ribbon xml that may be fractionally closer to your requested behaviour

Code: Select all

<customUI xmlns='http://schemas.microsoft.com/office/2009/07/customui'>
  <ribbon startFromScratch='true'>
    <tabs>
      <tab idMso='TabPrintPreviewAccess' visible='true' />
      <tab id='dbMyOptions' label='Options' insertBeforeQ='TabPrintPreviewAccess' visible='true'>
        <group id='PrintOpts' label='Print Options' autoScale='true' >
          <control idMso='FilePrintPreview' size='large' visible='true'/>
        </group>
      </tab>
    </tabs>
  </ribbon>
</customUI>

Leesha
BronzeLounger
Posts: 1488
Joined: 05 Feb 2010, 22:25

Re: Form Controls

Post by Leesha »

Thanks! I will give it a try. BTW, the custom icon shows it my task tray but the icon in the upper left corner of the database is the MS Access Icon.

Leesha
BronzeLounger
Posts: 1488
Joined: 05 Feb 2010, 22:25

Re: Form Controls

Post by Leesha »

I like the new xml that you sent much better! Thanks!