Mina Garas Daniel
Registered User.
- Local time
 - Today, 11:50
 
- Joined
 - Jul 21, 2017
 
- Messages
 - 66
 
Hello everyone
I have a problem and try many times to solve it but i failed
i build StartUp form to disable startup properties
in screen splash on load event
i wrote below code
	
	
	
		
and use following module its name modStartUpProps to disable startup properties
	
	
	
		
the problem i face every thing working good except ribbon still appear not hidden
Can anyone help
Thanks
 I have a problem and try many times to solve it but i failed
i build StartUp form to disable startup properties
in screen splash on load event
i wrote below code
		Code:
	
	
	Private Sub Form_Load ()
    ' Go Modal to Lock Navigation Pane
       Me.Form.Modal = True
       ' Hide Navigation Pane
       DoCmd.NavigateTo "acNavigationCategoryObjectType"
       DoCmd.RunCommand acCmdWindowHide
       ' Hide Ribbon
       DoCmd.ShowToolbar "Ribbon", acToolbarNo
       ' Lock Navjgation Pane
       DoCmd.LockNavigationPane (True)
call 
End Sub
	and use following module its name modStartUpProps to disable startup properties
		Code:
	
	
	Option Compare Database
Option Explicit
Function StartUpProps(strPropName As String, Optional varPropValue As Variant, _
          Optional ddlRequired As Boolean) As Variant
    
' From Securing Your Microsoft Access Databases
' Modified from MS Access 97 examples by Garry Robinson.
' This function requires a reference to DAO library
    
' This function will both return and set the value of startup properties
' in your database.  It can also be used for other database properties
' with some slight modification.
Dim dbs As DAO.Database, prp As DAO.Property, varPropType As Variant
Const conPropNotFoundError = 3270
If IsMissing(ddlRequired) Then
  ddlRequired = False
End If
    
' Because this code is specific to the startup properties, we assume that the
' data type of the property is Boolean unless stated otherwise
varPropType = dbBoolean
Select Case strPropName
  Case "StartupForm", "AppIcon"
    varPropType = dbText
End Select
    
Set dbs = CurrentDb
' This function will either set the value of the property or try to
' return it.  It knows which mode it is in by the existence of the
' property value in the procedure that called the function.
If Not IsMissing(varPropValue) Then
' As we change the value of the startup property, we will first try to
' assign that value.  If the property does not exist, it will be
' added to the database object using the error handling code.
 
  On Error GoTo AddProps_Err
  dbs.Properties(strPropName) = varPropValue
  StartUpProps = True
Else
' If we find out the value of the startup property, we first see if
' that value exists.  If the property does not exist, we will return a null string.
 
  On Error GoTo NotFound_Err
  StartUpProps = dbs.Properties(strPropName)
End If
StartupProps_End:
  On Error Resume Next
  Set dbs = Nothing
  Set prp = Nothing
  Exit Function
AddProps_Err:
 
  If Err = conPropNotFoundError Then
    'Property not found when adding a property value
    Set prp = dbs.CreateProperty(strPropName, varPropType, _
               varPropValue, ddlRequired)
    dbs.Properties.Append prp
    Resume Next
  Else
    'Unknown error.
    StartUpProps = False
    Resume StartupProps_End
  End If
NotFound_Err:
    If Err = conPropNotFoundError Then
      'Property not found when returning a property value
      StartUpProps = Null
      Resume Next
    Else
      'Unknown error.
      StartUpProps = False
      Resume StartupProps_End
    End If
End Function
Sub resetStartProps()
'Reset all the startup properties by deleting them
'Generally this is only advisable if you then intend to recreate
'the Starup properties using the ddlRequired variable
  DeleteStartupProps "StartupShowDBWindow"
  DeleteStartupProps "StartupShowStatusBar"
  DeleteStartupProps "StartupMenuBar"
  DeleteStartupProps "StartupShortcutMenuBar"
  DeleteStartupProps "AllowBuiltinToolbars"
  DeleteStartupProps "AllowFullMenus"
  DeleteStartupProps "AllowShortcutMenus"
  DeleteStartupProps "AllowToolbarChanges"
  DeleteStartupProps "AllowBreakIntoCode"
  DeleteStartupProps "AllowSpecialKeys"
  DeleteStartupProps "AllowBypassKey"
  StartUpProps "StartupShowDBWindow", False, True
  StartUpProps "StartupShowStatusBar", False, True
  StartUpProps "StartupMenuBar", False, True
  StartUpProps "StartupShortcutMenuBar", False, True
  StartUpProps "AllowBuiltinToolbars", False, True
  StartUpProps "AllowFullMenus", False, True
  StartUpProps "AllowShortcutMenus", False, True
  StartUpProps "AllowToolbarChanges", False, True
  StartUpProps "AllowBreakIntoCode", False, True
  StartUpProps "AllowSpecialKeys", False, True
  StartUpProps "AllowBypassKey", False, True
 
End Sub
Function DeleteStartupProps(strPropName As String) As Boolean
'Function requires a reference to DAO library
Dim dbs As DAO.Database, prp As DAO.Property
Const conPropNotFoundError = 3270
    
DeleteStartupProps = False
    
On Error GoTo deleteStartupProps_Err
CurrentDb.Properties.Delete (strPropName)
DeleteStartupProps = True
deleteStartupProps_End:
  On Error Resume Next
  Set dbs = Nothing
  Set prp = Nothing
  Exit Function
deleteStartupProps_Err:
  If Err = conPropNotFoundError Then  ' Property not found.
    DeleteStartupProps = False
    Resume Next
  Else
    'Unknown error.
    Resume deleteStartupProps_End
  End If
End Function
	the problem i face every thing working good except ribbon still appear not hidden
Can anyone help
Thanks