Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Home > TechHelp > Directory > Access > Disable Printing 3 < Disable Printing 2 | Hide Access >
Back to Disable Printing 3    Comments List
Pinned    Upload Images   @Reply   Bookmark    Link   Email  
Transcript
Richard Rost 
          
14 months ago
Today is part 3 and the final part of my "TechHelp" series. If you want to know how to disable print options so you can still let someone preview a report but not print it, well, go start with part 1 and watch part 2, and today is part 3.

In part one, we turned off the Control-P, so you can't press Control-P to print. In part two, we disabled the right-click menu. In the extended cut, I showed you how to only disable the right-click menu in specific objects like specific reports.

Today, we're going to cover the most pesky of the options, which is that print preview ribbon tab. All right, so we're in our database. Go to your customer form, go to orders, go to the invoice. All right. Now we've gotten rid of Control-P. All right, you can't use that. We can't right-click. This is something that we did in the extended cut. I just showed you guys how to completely disable it, but in the extended cut, we made this little guy. So if you right-click on it, it just says use the print button on the invoice form, which will put a little button over here. Okay, but we still got this. Even if we turn off all the menuing stuff, you still get this.

So how do we get rid of it? Well, the only way to get rid of this is to replace it with a custom ribbon. Okay, now there are a lot of different steps you can do. I cover customizing the ribbon in my Access Developer Level 44 class. It's pretty in-depth. But what I'm going to show you today, real simply, is how to create a blank ribbon and replace the print preview ribbon with that. It's not that hard. Let's see how to do it.

Close whatever objects you've got open. You can leave the main menu open. That's fine. The first step is to create a table to hold all of our ribbon data. It's going to be a system table. Alright, so go to create, table design, you're going to put these three fields in it: ID by itself, that's going to be your autonumber, okay; RibbonName, no space, short text, that's the name of the ribbon; and then RibbonXML, and that's a long text field. That's it, just those three things. I believe you can add more, but you have to have those three fields. I don't really know why you'd want to add more, but okay.

All right, save this as, you ready for it, USysRibbons. Just like that. Here, I'll zoom in so you can see it better. Alright, there are your fields, and that's the name of it, USysRibbons.

And I'm not sure, but I think the "Sys" has to be capitalized. Usually, it doesn't matter. Some things do matter because the ribbon stuff, some of it is case sensitive. I don't think this is though. USysRibbons. Alright? Primary key defined, you say yes, and there you go. There's your table, and there's your data, or your fields. Okay?

Alright. Alright, we're going to put some data in here. Go over to datasheet view. Okay. We're going to open this up like this, make it nice and big, make this nice and tall. You'll see why in a second. Okay, the ribbon name is going to be Print Preview. No spaces, okay. That's what you're going to put in the RibbonXML field. Again, I'll zoom in for you so you can see it better. Let's see, here's my zoom. Alright. Zoom.

Uh, Gold members, you can copy that of my database if you want to, everybody else gets typing, and if you watched my video on how to do OCR screen capture, you can do with Google now. You can just do a screen capture, then just drop in Google as an image of it, and it will OCR the text for you. But that's it, what does this saying?

Well, this is really creating a new ribbon. It's just telling you what the XML stuff is. Don't worry about it. Just don't worry about it. This says, "Give me a new ribbon and start from scratch." Now normally in here, you'd have other commands. You'd have groups and controls and labels and drop-down boxes and all kinds of stuff. This is just saying, "We're going to start a new ribbon from scratch." That's what true is, which gives you a blank new ribbon, but it's got no controls in it. So it's going to basically be a blank, empty ribbon. Okay, makes sense?

Okay, that's the simplest blank ribbon. Alright, save that, close it. Now, what you're going to do at this point is you have to restart your database. So shut it down and restart it because Access only reads that ribbon table when it loads the first time. So if you make any changes to it, you've got to shut down and restart Access, which I think is a pain. But you got to do what you got to do.

Now when the database is back open, notice. You're not gonna see your table. Why? Because it's a system table; normally, system tables don't show up in here.

So right-click up here, go to navigation options, and you can turn on Show System Objects. Alright, there's a whole bunch of 'em, don't touch this stuff, don't touch it. But look, there's USysRibbons. So if you have to get back in here to modify it, there it is, alright. But I'm going to leave this stuff off because it just clutters things. I don't like to look at it all the time. Okay, there are hidden objects, and there are system objects. I usually leave hidden objects on because I like to see sometimes when I hide stuff and then I go try to find it later, I'm like, "Where did I put it?" But I don't need to see the system objects. But it's in there, and Access now has loaded up that custom ribbon called Print Preview.

But we still have to assign it to the report. See, this guy still comes up. So what you're going to do is, I can't even right-click on this, I turned off the right-click menu. Okay, alright. We got to come in through the navigation pane, right-click, design view, open up the properties for the report, come over here to Other, and find Ribbon Name. Drop that down, and there's Print Preview. Okay, save it, close it, close it, close it, all right, open it back up again, and now there you go. The print preview ribbon is now hidden.

Now we're still not out of the woods just yet, even though we turned off the custom ribbon just for this guy. The user can still go to one more place to print this thing. That's File > Print, and it's right there. So we have to turn that off too. Okay, now this is a special part of the ribbon called the backstage. It's under File. What we can do is we can modify the backstage by taking Print off of here, but unfortunately, this is going to be for the entire database. But like I said, there are other ways that you can give your user the ability to print. But in order to turn that off, it's got to be at the database level. Okay?

How do we do that? Well, we have to make one more modification to our custom ribbon. So let's turn back on the system objects. Alright. Go back into your USysRibbons. We're going to make another ribbon in here. We're going to call it Backstage. Alright. Let me give you the code for it. Let me copy it. I got it on my clipboard here. I had to play with this for a while to get it working.

There it is, alright, there it is right there. Let me zoom in so you can see it better. Very similar to the other one. Alright, you got the custom UI, all this stuff here. You got "ribbon start from scratch" is false for this one because we want to use the rest of what's on the File backstage, okay? But we just want to modify this guy.

ID MST abPrint means I want to make the print tab invisible. That's what this does. Hit okay. We've got a second custom ribbon in here now. Close this. Close down the database because it has to reload it again. Open her up. Okay, now you're still going to see it under File > Print because we haven't assigned it yet. So go to options, current database, scroll down, and this thing right here, Ribbon Name. Drop that down and pick your backstage ribbon now. Okay, hit okay, restart the database again,

and now this time when it opens up, now you will see File, no Print. Look at that.

So now we've got our form, our report right here. No ribbon print preview tab. No option for File > Print, okay, and no Control-P, and no right click. So now, the only way the user is going to print this is if they screenshot it. They can literally zoom in and use a screen capture tool. That's it. They cannot print this any way that I know of unless I'm missing something. I've been doing this forever. This is the only four ways I can think of to print this.

So what you need to do now is make them their own print button here. So after they preview it, click on this one, and then it will print it. And that's it. Now of course, there is the quick access toolbar across the top. You want to turn that off too. But that's easy.

Okay, there you go. So there's your three-part series. How to disable printing. We've disabled it from the keyboard, we've disabled it from the right-click shortcut menu, we've disabled it from the ribbon, and also part of the ribbon is the backstage, the File > Print. So there are four different ways that you can print something. There you go.

That was my day, putting all that together. Like I said, this ribbon stuff is not easy, but I go over it in a lot more detail from the ground up. All that stuff that I just said, "Here's the code, don't worry about it," well, I explain it fully in my "TechHelp" series so you understand what it all is. We go through the XML and what each of these objects are. So check that out if you want to learn more about customizing the ribbon, customizing the backstage view, customizing the right-click pop-up menus, all that stuff.

And again, if you want to learn more about securing your database, you can control what users can do, what in the database to do, user log on to setup groups, we create a system log, I show you how to encrypt the database, all that stuff that's all covered in my Security Seminar. But there you go, that is going to be your "TechHelp" video for today. I hope you learn something. Live long and prosper, my friends. I'll see you next time.

TOPICS
Creating a blank custom ribbon in Access
Creating a system table to store ribbon data
Configuring RibbonName and RibbonXML fields in a table
Using USysRibbons system table in Access
Creating a simple blank ribbon through RibbonXML
Restarting Access to load custom ribbon changes
Access navigation options and showing system objects
Assigning a custom ribbon to a specific report
Disabling File > Print from the backstage view
Modifying the backstage view in Access with custom XML
Securing a database to limit print functionalities
Adding a user-specific print button on an Access form
Explanation of Access ribbon and backstage view customization
Controlling user permissions and database security in Access

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Disable Printing 3.
 

 
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2025 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/12/2025 9:29:23 PM. PLT: 2s