Avatar of urjudo
urjudo
Flag for United States of America asked on

Report print view option in Access 2016 runt time

Hi Experts,
Is any way I can enable the "More" option next to the "PDF or XPS Datain the print view in office 365 access 2016 run time?  I would like the users have ability to merge the report to word but it only works on full version not in run time.  If possible to enable it in runt time version?  I attached the screen shot.

Thank you,
Report.jpg
Microsoft Access

Avatar of undefined
Last Comment
urjudo

8/22/2022 - Mon
Dale Fye

There are a lot of features of the full version which are not available in the Runtime version.


Access will not let you use the built-in shortcut menus in the run-time environment, but you can create and use your own.  One way to do this is to copy the print menu and rename it, then remove all of the items I'm not interested in.  The easiest way I know to do that is to use the Access Shortcut Tool.  Which makes it easy to copy an existing shortcut menu or create your own, from scratch.  What I do is create a shortcut (right click) menu for all my reports, with options, Print, Save as PDF, Send as attachment, Export to Excel, and Close.  


These article should help you get a better understanding of short-cut menus

Understanding and using Commandbars

Understanding and using Commandbars, Part II

Commandbars (Part III) - Using built-in menus

Using shortcut menus in Access run-time environment



John Tsioumpris

Check this code if this is what you want
Private Sub Form_Load()
CreateSimpleShortcutMenu
Me.Field1.ShortcutMenuBar = "ShowDataShortcutMenu"
End Sub

Open in new window

Sub CreateSimpleShortcutMenu()
      Dim newMenu As CommandBarControl
Dim cmb As CommandBar
  On Error Resume Next 'If menu with same name exists delete
  CommandBars("ShowDataShortcutMenu").Delete

    'CommandBars("ShowDataShortcutMenu").Delete

    Set cmb = CommandBars.Add("ShowDataShortcutMenu", msoBarPopup, False, False)
    With cmb
.Controls.Add msoControlButton, 11725, , , True


    End With

    Set cmb = Nothing
    Set newMenu = Nothing

End Sub

Open in new window

urjudo

ASKER
@Dale,
Thanks for the information, I'm still trying to understand how to do that.

@John,
I did tried your suggestion, but I got a compile error "user-defined not defined" on
 Dim newMenu As CommandBarControl  ('CommandBarControl" - user-defined not defined)
 Dim cmb As CommandBar ("CommandBar" - user-defined not defined)

also shall I put the "Private Sub CreateSimpleShortcutMenu()" code in a module or just put anywhere in the report?


Me.Field1.ShortcutMenuBar = "ShowDataShortcutMenu" -- what do you mean "Me.Field1"?  
  it's not Me.ShortcutMenuBar = "ShowDataShortcutMenu?

Thanks
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
John Tsioumpris

Some reference probably is missing..I will take a look
urjudo

ASKER
@John,
I changed Dim newMenu As CommandBarControl to Dim newMenu As Object but still have problem withe the Dim cmb as CommandBar

also what's the difference if the code is in "On_Load" or "On_Open"?
John Tsioumpris

Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
ASKER CERTIFIED SOLUTION
Dale Fye

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
urjudo

ASKER
@Dale,
I tried to test your code, it gave me an error message "Microsoft Access can not find TestShortcutMenu"  also on the report under Short Cut Menu Bar I  don't see anything in the drop down like yours.
Dale Fye

Did you run that procedure from the immediate window after you pasted it into a standard code module, not the report code module?  If not, do so using the immediate window:

Call CommandbarTest

Open in new window

Once you have run that code, you should see a dropdown list in the Shortcut Menu property of the report.


urjudo

ASKER
@Dale,
I paste the code into a standard module called "MyNewMenu" not in the report.  When I run "call commandbarTest in the Immediate window, the error message was "Compile error: Ambiguous name detected: commandbarTest
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
urjudo

ASKER
@Dale,
now I can see the TestShortcutMenu in the short cut menu bar but when in the run the report, right click, I see nothing but with a clear little square box .
urjudo

ASKER
@John,
I'm looking at your code, I have a question about this line:
Set cmb = CommandBars.Add("ShowDataShortcutMenu", msoBarPopup, False, False)

is suppose to be:
Set cmb = CommandBars.Add("ShowDataShortcutMenu", msoBarPopup, False, True) ?

I test both, it seems the same, so should I set the "temporary" to True or False?
urjudo

ASKER
here is the code that I modified from John's code.  I placed in a standard module so I can use this code on other reports, but I run to a problem is if I don't call the function On_Load on the report, the "vbaShortcutMenu" is disappears from the shortcut menu bar every time after I compact & repair the database unless I add "call CustomShortMenu" in On_Load on the report then it stays.  what did I do wrong?

Public Function CustomShortCutMenu()
Dim menuName As Object
Dim cb As CommandBar
Dim CBB As CommandBarButton

menuName = "vbaShortcutMenu"

On Error Resume Next
Application.CommandBars(menuName).Delete

On Error GoTo 0

Set cb = Application.CommandBars.Add(menuName, msoBarPopup, False, True)


Set CBB = cb.Controls.Add(msoControlButton, 11725, , , True)
CBB.Caption = "Export to Word..."
CBB.FaceId = 42


Set cb = Nothing
Set CBB = Nothing
End Function
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Dale Fye

You only want this code to run once, period.  You want to set the "Temporary" argument for both the Comandbar and the control to FALSE, this way you don't need to call this procedure ever again, ever.  


But if you do this, you don't want to do:

Application.CommandBars(menuName).Delete

Open in new window


Where did you get the FaceID = 42?



urjudo

ASKER
@Dale,

1).What's difference between:
       Set cb = Application.CommandBars.Add(menuName, msoBarPopup, False, False)
   and
      Set cb =CommandBars.Add(menuName, msoBarPopup, False, False)

  If I put the code in the as Public Function, Shall I use Application.CommandBar.Add instead CommandBars.Add?


2). Is this code below correct?

Public Function CustomShortCutMenu()
Dim menuName As Object
Dim cb As CommandBar
Dim CBB As CommandBarButton

menuName = "vbaShortcutMenu"


Set cb = Application.CommandBars.Add(menuName, msoBarPopup, False, False)


Set CBB = cb.Controls.Add(msoControlButton, 11725, , , True)
CBB.Caption = "Export to Word..."


Set cb = Nothing
Set CBB = Nothing
End Function

I tried #2 but still have the same issue (not show in the ShortCut Menu Bar drop down)
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Dale Fye

John,


I don't understand why you keep encouraging him to make this a temporary commandbar/control and set the ShortcutMenuBar property at run-time.  If you define the commandbar and control as permanent ([Temporary] = False) then you never need to run that code again, and can simply set the ShortcutMenuBar property of the report to the menu name.


Dale

Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
John Tsioumpris

Good point Dale
Dale Fye

urjudo,


I'm going to back out of this question.  John and I. although using similar techniques, are just confusing you, so I'm going to let you work with John from here on out.


Dale

John Tsioumpris

Dale it would be best not to back out after all you are the "master" ...i rarely deal with CommandBars ... this was a nice feature in Access 2003...but now its too much of a trouble ...i use Ribbon for all these extra features..
As for the CommandBars i just had some small piece of code laying around....
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Dale Fye

John,


I would encourage you to download the Access Shortcut Tool, much easier to use than the method in 2003.


Dale

John Tsioumpris

Oh ... i must admit i didn't knew about it...thanks.
urjudo

ASKER
@Dale & John,
Thank you for both of your efforts to answer my question.  I did try to create a Ribbon and for some reason it did not show.  Like John was saying, I like the Access 2003 version coz it's much easier to create custom shortcut and menu bar.  I don't know why Microsoft removed some of the great features after 2003 version.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
urjudo

ASKER
Thanks again for all your time!  very appreciated!
Dale Fye

Did you download and install the Access Shortcut Tool, hyperlinked in my first post?

This tool was designed to replace the method used in A2003 and has made it very easy for me to make Shortcut menus over the last 4 years.  Give it a try.

urjudo

ASKER
@Dale,
I did download the Access Shortcut Tool, but it's a read only and every time when I open this sample database, it runs the Access Shortcut Tool, is this normal?.  Is any way I can unchecked the ready only and make it as full version? also how it works (I means I do I copy to my database).

Thanks
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Dale Fye

It's not read only, but if you are trying to launch it from within the zip file, it would be.

There is a text file with instructions in the zip file; follow those instructions to install it so that you can use it to create short-cut menuse within all of your Access applications.

urjudo

ASKER
Sorry, one more question, I did follow the instructions, and I can see under the Add-Ins in my program, do you have any instruction how to use it?