Urgent hide ribbon vba 2013

Hi EE

In my startupform in the OnLoad event I have

Docmd.ShowToolBar "Ribbon", acToolBarNo

When I open the form in design view the Fibbon is Completely hidden. When I make an Accde and run the app I still get showing File and Home. I am not sure why this should happen. Any Help appreciated.

chestera
chesteraAsked:
Who is Participating?
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Connect With a Mentor Infotrakker SoftwareCommented:
As others have said, you cannot hide the ribbon, but you can use your own custom one. The reason you see different behavior in a compiled vs design view is ... you're in Design view, and Access acts differently than when it's in "runtime" view.
0
 
Michael FowlerConnect With a Mentor Solutions ConsultantCommented:
Run this code once to reset the properties and then retry

Function ResetStartupProperties()
    ChangeProperty "StartupForm", dbText, ""
    ChangeProperty "StartupShowDBWindow", dbBoolean, True 
    ChangeProperty "StartupShowStatusBar", dbBoolean, True
    ChangeProperty "AllowBuiltinToolbars", dbBoolean, True      
    ChangeProperty "AllowFullMenus", dbBoolean, True
    ChangeProperty "AllowBreakIntoCode", dbBoolean, True
    ChangeProperty "AllowSpecialKeys", dbBoolean, True
    ChangeProperty "AllowBypassKey", dbBoolean, True
    MsgBox "Startup Properties UnSet"
End Function

Open in new window

0
 
chesteraAuthor Commented:
Michael74

Thank you michael. I will try now

Alan
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
chesteraAuthor Commented:
Michael74

I have run function as is from a form Call ResetStartUpProperties. I get the message "Expected Procedure not Variable"

Alan
0
 
Michael FowlerSolutions ConsultantCommented:
Try running this in the immediate window

   ChangeProperty "StartupForm", dbText, ""
    ChangeProperty "StartupShowDBWindow", dbBoolean, True 
    ChangeProperty "StartupShowStatusBar", dbBoolean, True
    ChangeProperty "AllowBuiltinToolbars", dbBoolean, True      
    ChangeProperty "AllowFullMenus", dbBoolean, True
    ChangeProperty "AllowBreakIntoCode", dbBoolean, True
    ChangeProperty "AllowSpecialKeys", dbBoolean, True
    ChangeProperty "AllowBypassKey", dbBoolean, True
    MsgBox "Startup Properties UnSet"

Open in new window


Modified by SouthMod
0
 
chesteraAuthor Commented:
Michael74

Thank you
0
 
chesteraAuthor Commented:
Michael74

When run in immediate window I get the message "Can't Compile Module". When I go into Debug and compile the complete app I get the message "Sub or Function not Defined"

Alan
0
 
Michael FowlerSolutions ConsultantCommented:
In the immediate window you leave out the Function ResetStartupProperties() and End Function lines

But there is no reason why this should run
http://www.wvmitchell.com/tips/Security%20-%20locking%20down%20the%20database.htm
0
 
chesteraAuthor Commented:
Michael74

Another strange problem When I open access the Home, Create, External Data, and Database tools are unchecked
If I re-check them select ok then close when I reopen they are unchecked again. I have uninstalled and then reInstalled but no change
0
 
Michael FowlerSolutions ConsultantCommented:
I am beginning to think that this database is corrupt.

This guide has some steps you can use to try to resolve the issue
http://www.everythingaccess.com/tutorials.asp?ID=Access-Database-Corruption-Repair-Guide
0
 
chesteraAuthor Commented:
Michael74

I have tried on other dB's even created  a small testdb still the same.
With the ResetStartupProperties to ensure I am doing it correctly I create a module and enter
Function ResetStartupProperties()
    ChangeProperty "StartupForm", dbText, ""
    ChangeProperty "StartupShowDBWindow", dbBoolean, True
    ChangeProperty "StartupShowStatusBar", dbBoolean, True
    ChangeProperty "AllowBuiltinToolbars", dbBoolean, True      
    ChangeProperty "AllowFullMenus", dbBoolean, True
    ChangeProperty "AllowBreakIntoCode", dbBoolean, True
    ChangeProperty "AllowSpecialKeys", dbBoolean, True
    ChangeProperty "AllowBypassKey", dbBoolean, True
    MsgBox "Startup Properties UnSet"
End Function

Then from a form I make the call

Call RestartupProperties
0
 
Michael FowlerSolutions ConsultantCommented:
I am at work and cannot test but I cannot see any reason the code should not work.

I have to ask but you are calling ResetStartupProperties and not RestartupProperties
0
 
chesteraAuthor Commented:
Michael74
ResetStartupProperties is correct look at the function above.
I have taken a fresh PC  new Db and I get the message Sub or Function not Defined so I created a Global variable
ChangeProperty it fixed that message but now I get "Expected Prodedure not Variable". I still think I am doing something wrong but can't see what
0
 
Michael FowlerSolutions ConsultantCommented:
In your post above you wrote

Then from a form I make the call

Call RestartupProperties

Which why I had to ask if you are calling ResetStartupProperties  and not RestartupProperties.
0
 
chesteraAuthor Commented:
Michael74
 Yep I am using Call ResetStartupProperties . By the way I fixed the missing Ribbons. When I was using Access 2010 I used an Add on called classic Menu and some how found it's a way onto access 2013. When I removed, the missing ribbons returned
0
 
Michael FowlerSolutions ConsultantCommented:
Great to hear

Going forward you may still want to use this code for locking your forms
http://www.wvmitchell.com/tips/Security%20-%20locking%20down%20the%20database.htm
0
 
chesteraAuthor Commented:
Michael74

I am using the correct call but still getting "Expected Procedure not Variable and it halts on ChangeProperty. If I can get it working I will use.
0
 
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
<<When I open the form in design view the Fibbon is Completely hidden. When I make an Accde and run the app I still get showing File and Home. I am not sure why this should happen. Any Help appreciated.>>

   Microsoft changed the ribbon behavior in A2013.   Unlike A2010 and prior, you can no longer fully hide the ribbon and use your own mennu bars.   Any old style menu bars appear as a tab on the ribbon.

 You'll need to write custom ribbons for any menu operations you want.

Jim.
0
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
I am using the correct call but still getting "Expected Procedure not Variable and it halts on ChangeProperty. If I can get it working I will use.
ChangeProperty is not a builtin Access function. It's obviously a custom function someone wrote that manipulates Properties in the database. I would not assume your db is corrupt, but rather that you're calling a function that is not present in the db.

To "fix" this, you'd need to include the ChangeProperty function, or modify the code shown to use standard VBA methods to work with Properties.
0
 
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
The ChangeProperty() function code originally appeared as part of the Access help as SetCustomProperty (posted below).

However, that's still not going to take care of your problem, as A2013 had a fundamental change in the way the ribbon is handled.

Jim.

Dim strName As String, strValue As String

' Set property name variable.
strName = "LastUserName"
' Set property value variable.
strValue = InputBox("Please enter your full name")
If SetCustomProperty(strName, dbText, strValue) <> True Then
	' Error occurred trying to set property.
	MsgBox "Error occurred trying to set property."
End If

Function SetCustomProperty(strPropName As String, intPropType _
	As Integer, strPropValue As String) As Integer

	Dim dbs As Database, cnt As Container

Dim doc As Document, prp As Property

	Const conPropertyNotFound = 3270	' Property not found error.
	Set dbs = CurrentDb					' Define Database object.
	Set cnt = dbs.Containers!Databases	' Define Container object.
	Set doc = cnt.Documents!UserDefined	' Define Document object.
	On Error GoTo SetCustom_Err
	doc.Properties.Refresh
	' Set custom property name. If error occurs here it means
	' property doesn't exist and needs to be created and appended

' to Properties collection of Document object.
	Set prp = doc.Properties(strPropName)
	prp = strPropValue					' Set custom property value.
	SetCustomProperty = True

SetCustom_Bye:
	Exit Function

SetCustom_Err:
	If Err = conPropertyNotFound Then
		Set prp = doc.CreateProperty(strPropName, intPropType, strPropValue)
		doc.Properties.Append prp		' Append to collection.
		Resume Next
	Else										' Unknown error.
		SetCustomProperty = False	

Resume SetCustom_Bye
	End If
End Function

Open in new window

0
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Right - but unless you've implemented that Function in your database, the code will error out.
0
 
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
Yup.    I was just posting it here so no one had to use any links int he future.

Jim.
0
 
chesteraAuthor Commented:
Scott McDaniel

Thank you Scott I thought there was more to it. Seems it wont't fix my problem anyway.

My original question  is if I put the following in tha on load event of my startup form it completely hides the ribbon when
I open that form

Docmd.ShowToolBar "Ribbon", acToolBarNo

But when I make an accde and run I get the File and Home portion of the ribbon everything else is hidden. I have a small app using a swithcboard type menu and would be good if the ribbon wasn't shown.

By the way I am using 2013



Alan
0
 
chesteraAuthor Commented:
Scott McDaniel

Thanks Scott understood. I'm progressing quite well using Ribbon Creator

Alan
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.