473,854 Members | 1,480 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Closing Ribbon With VBA In Access

1 New Member
I am trying to close the ribbon in my Access application so that the user will not have it available. I used the following code I found in a previous answer on this site.

Expand|Select|Wrap|Line Numbers
  1. DoCmd.ShowToolbar "Ribbon", acToolbarNo
Interestingly enough, it worked exactly two times correctly and then stopped working.

Any ideas on why it stopped working? Has anyone else had this happen?

Dec 20 '11 #1
3 4281
200 New Member
I use the same code to close the ribbon. The code here removes the left navigation bar also. Works every time for me.

Expand|Select|Wrap|Line Numbers
  1.     DoCmd.ShowToolbar "Ribbon", acToolbarNo
  2.     DoCmd.SelectObject acTable, , True
  3.     DoCmd.RunCommand acCmdWindowHide
Re-enable with this:

Expand|Select|Wrap|Line Numbers
  1.     DoCmd.ShowToolbar "Ribbon", acToolbarYes
  2.     DoCmd.SelectObject acTable, , True
  3.     DoCmd.SelectObject acForm, Me.Name
Dec 21 '11 #2
2,322 Recognized Expert Moderator Top Contributor
You need to be more exact when you say "stopped" working.

When debugging, (and Before posting), always start by making absolutely sure that your code is run. You can look in our Access insights section for some articles on debugging in VBA, but a simply way for a "novice" is to simply add a msgbox preceeding the statement in question:
Expand|Select|Wrap|Line Numbers
  1. MsgBox "About to turn off Ribbon"
  2. DoCmd.ShowToolbar "Ribbon", acToolbarNo

The reason I bring this up, is that from what little information you have given, my best guess is that your code is simply not firing/executing.
Dec 21 '11 #3
32,584 Recognized Expert Moderator MVP
These may help :
Dec 21 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

by: u7djo | last post by:
Hi, I'm currently building a function in Access that creates an Excel spreadsheet but it doesn't look like the Excel object is being destroyed correctly as the Excel module is still showing in the task manager and I'm unable to open the spreadsheet without first closing down Access. Can anyone help!? Dave Public Function CreateInputSheet(scriptName As String, ParamArray
by: alecjames1 | last post by:
I have a form which the user must complete before closing. I have disabled the window x button and use my own exit button. When selected it checks to see if the user has completed the entries otherwise it cancels the close. However, the user can still right click on the task bar and close my application. Is there any way of preventing this. Thanks Alex
by: Vegar Hansen | last post by:
Hello everone. Can somebody help me? When I run my code I can read, write to and delete from database, but when I have done one of these things and try to copy the databasefile from my folder to an other folder with Windows Explorer the system "hangs up" for a couple of minutes. It seems like the databasefile is not closed. But after 2 - 3 minutes the system recover, and I can copy the file without any system "hangups".
by: spicyz | last post by:
I'm receiving an exception when my webmethod exits after opening/closing an Access database. I can reproduce this easily enough by creating a new default ASP .NET Web Service in VS.NET 2003. Adding this code to the default HelloWorld() webmethod will cause the problem. String* sConnection = S"Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=c:\\mydb.mdb";
by: news.microsoft.com | last post by:
Hope someone can help Working Visual Web Developer 2005 using Access databases It all works fine using the WebDevelopers webserver but when I use IIS I get these errors The Microsoft Jet database engine cannot open the file 'C:\CallidusWorld\App_Data\oakleafAccounts.mdb'. It is already opened exclusively by another user, or you need permission to view its data.
by: rlntemp-gng | last post by:
RE: Access 2003/Excel 2003 Problem: After I close the Access application completely, I go out to the Task Manager and there is an Excel.exe object still sitting out there. My Access application creates an Excel file (MyTestFile.XLS) just fine per the code submitted here. This code closes the Excel file created and close the Excel application, leaving the Access app open. Then I close Access. After Access is closed, I go to the task...
by: anthony | last post by:
In Access 2007, why does a query field designed as Term: ! ! return 00:00:00 when cboTerm actually contains 08SP. This works as expected in Access 2003?
by: scott.tang | last post by:
I'm experiencing a very strange problem. My application is MS Access front-end and MS SQL server back-end database. I have a SQL statement that deletes records from a table after an export process. The problem is occasionally when the delete statement is executed, these records no longer display on List Box (not even in the MS Access link table). But when close and reopen the form, those records reappear. It almost like MS SQL server...
by: peter1952 | last post by:
I would like to automate closing an Access 2003 database at the end of running a macro. How can I do this?
by: TroyLad | last post by:
I want to confirm with the user that they have printed a report when they click on the close button of a previewed report. If they choose not to close (in answering my msgbox) I would like to not close it. I tried CancelEvent but that didn't work. Any ideas? Thanks for your help!
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.