I have a ChangeProperties Function I use to turn off/on full menu access based off the CurrentUser(). I have this fire off in the AutoExec macro for the database. The problem I have is that it does not actually change the menus until the next time I log in. I want the change to take affect before the user gets to the swithboard. Am I doing something wrong? Below is my code
Code:
_________________________
Function ChangeProperty(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer
Dim dbs As Database, prp As Property
Const conPropNotFoundError = 3270
Set dbs = CurrentDb
On Error GoTo Change_Err
dbs.Properties(strPropName) = varPropValue
ChangeProperty = True
Change_Bye:
Exit Function
Change_Err:
If Err = conPropNotFoundError Then ' Property not found.
Set prp = dbs.CreateProperty(strPropName, varPropType, varPropValue)
dbs.Properties.Append prp
Resume Next
Else
' Unknown error.
ChangeProperty = False
Resume Change_Bye
End If
End Function
________________________
Function ChangeStartUp()
Dim User As String
User = CurrentUser()
'If user is Admin, then allow full menus
If User = "Admin" Then
ChangeProperty "AllowFullMenus", dbBoolean, True
Else
ChangeProperty "AllowFullMenus", dbBoolean, False
End If
'Opens restricted swithboard for Edu, else opens normal
If User = "Edu" Then
DoCmd.OpenForm "Switchboard", acNormal, , "[ItemNumber] = 0 AND [SwitchboardID] = 6"
Else
DoCmd.OpenForm "Switchboard", acNormal, , "[ItemNumber] = 0 AND [SwitchboardID] = 1"
End If
End Function
_____________________________
Any help would be appreciated
Thanks
Glen
Code:
_________________________
Function ChangeProperty(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer
Dim dbs As Database, prp As Property
Const conPropNotFoundError = 3270
Set dbs = CurrentDb
On Error GoTo Change_Err
dbs.Properties(strPropName) = varPropValue
ChangeProperty = True
Change_Bye:
Exit Function
Change_Err:
If Err = conPropNotFoundError Then ' Property not found.
Set prp = dbs.CreateProperty(strPropName, varPropType, varPropValue)
dbs.Properties.Append prp
Resume Next
Else
' Unknown error.
ChangeProperty = False
Resume Change_Bye
End If
End Function
________________________
Function ChangeStartUp()
Dim User As String
User = CurrentUser()
'If user is Admin, then allow full menus
If User = "Admin" Then
ChangeProperty "AllowFullMenus", dbBoolean, True
Else
ChangeProperty "AllowFullMenus", dbBoolean, False
End If
'Opens restricted swithboard for Edu, else opens normal
If User = "Edu" Then
DoCmd.OpenForm "Switchboard", acNormal, , "[ItemNumber] = 0 AND [SwitchboardID] = 6"
Else
DoCmd.OpenForm "Switchboard", acNormal, , "[ItemNumber] = 0 AND [SwitchboardID] = 1"
End If
End Function
_____________________________
Any help would be appreciated
Thanks
Glen