UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> How to access AllowFullMenus option through VBA    
 
   
nakumar11
post Sep 7 2009, 01:17 AM
Post #1

New Member
Posts: 3



Hi,

There is an option AllowFullMenus under Access Option/Current Database. I need to access this through VBA. When I searched in the Help, I understand that we can set this through VBA. I tried, but unable to get the VBA code. Plese any one help me in solving this problem.
Go to the top of the page
 
+
alancossey
post Sep 7 2009, 02:19 AM
Post #2

UtterAccess Veteran
Posts: 442
From: Norfolk, UK



Hiya,
You can set it using

SetPropertyDAO CurrentDb, "AllowFullMenus", dbBoolean, AllowFullMenus

where AllowFullMenus is a boolean value you pass to the function SetPropertyDAO, which itself is defined thus

Function SetPropertyDAO(DAOObject As Object, _
PropertyName As String, _
PropertyType As Integer, _
PropertyValue As Variant) As Boolean
'Purpose: Set a property for an object, creating if necessary.
'Arguments: DAOObject = the object whose property should be set.
' PropertyName = the name of the property to set.
' PropertyType = the type of property (needed for creating)
' PropertyValue = the value to set this property to.

If HasDAOProperty(DAOObject, PropertyName) Then
DAOObject.Properties(PropertyName) = PropertyValue
Else
DAOObject.Properties.Append DAOObject.CreateProperty(PropertyName, PropertyType, PropertyValue)
End If

SetPropertyDAO = True
End Function

The reason for needing such a function is that by default the "AllowFullMenus" property of the database does not exist, so you need to create it first if you want to give it a value.

To find out whether ShowFullMenus is true or false, you can use a function thus

If HasDAOProperty(CurrentDb, "AllowFullMenus") = True Then
DatabaseAllowFullMenus = CurrentDb.Properties("AllowFullMenus")
Else
DatabaseAllowFullMenus = True
End If
Go to the top of the page
 
+
nakumar11
post Sep 11 2009, 06:51 AM
Post #3

New Member
Posts: 3



Thank you very much. I think similarly I can try for ribbon name property also. I will try for that and in case if I get any doubts, I will contact you.

Thanks again.
Go to the top of the page
 
+
alancossey
post Sep 11 2009, 07:29 AM
Post #4

UtterAccess Veteran
Posts: 442
From: Norfolk, UK



Yes, that would be fine. As a bit of an aside, I posted an Access add-in here which allows you to do this without having to write any of your own code. The main feature of the add-in is to enable developers to treat tables and queries as proper objects rather than just as members of collections, but I also stuck in a module which allows you quick access to these Access Option. Even if you don't want to use the add-in as an add-in you might find it helpful to just copy the code from the SMOGOptions module in that add-in. Just open the SMOG.mda file and copy the SMOGOptions module to your own database (or as much of it as you want).
Go to the top of the page
 
+
nakumar11
post Sep 15 2009, 01:41 AM
Post #5

New Member
Posts: 3



Thank you very much alan. Please help me in accessing ribbon name property under Access Option/Current Database. Based on the idea you have given for allowfullmenus, I tried for ribbon similarly. but some how I am unable to acheive it.
Go to the top of the page
 
+
alancossey
post Sep 15 2009, 02:00 AM
Post #6

UtterAccess Veteran
Posts: 442
From: Norfolk, UK



Public Property Get DatabaseRibbonName() As String
If HasDAOProperty(CurrentDb, "CustomRibbonID") = True Then
DatabaseRibbonName = CurrentDb.Properties("CustomRibbonID")
Else
DatabaseRibbonName = ""
End If
End Property

Public Property Let DatabaseRibbonName(ByVal RibbonID As String)
SetPropertyDAO CurrentDb, "CustomRibbonID", dbText, RibbonID
End Property
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Search  ·  Go to Top  ·  Lo-Fi Version Time is now: 31st July 2014 - 06:28 AM