Hello,
When I start my Access application I've created a login form. It connects to an employee-table and checks the username and password that's been filled in on the form. According to the user group (also stored in the table) I've created VBA-code to show or hide bars and menus. I'll show the example: (similar code has been posted several times at this forum, but I need to show it to make my question clear...)
----------------------------
Select Case Usergroup
Case 1 ' for example a guest account
Changeproperty "StartupShowDBWindow", DB_Boolean, False
Changeproperty "StartupShowStatusBar", DB_Boolean, False
Changeproperty "StartupShowDBWindow", DB_Text, "hoi"
Changeproperty "StartupShowStatusBar", DB_Boolean, True
Changeproperty "AllowFullMenus", DB_Boolean, False
Changeproperty "AllowShortcutMenus", DB_Boolean, False
Changeproperty "AllowBuiltinToolbars", DB_Boolean, False
Changeproperty "AllowToolbarChanges", DB_Boolean, False
Changeproperty "AllowBreakIntoCode", DB_Boolean, False
Changeproperty "AllowSpecialKeys", DB_Boolean, False
Changeproperty "AllowBypassKey", DB_Boolean, False
Function ChangeProperty(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer
Dim dbs As Object, prp As Variant
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
----------------------------
The code works fine, BUT only when I restart the application. However, that's not what I want. After pressing the login button I want to have the changes take effect instantly (so menus and bars should disappear).
My question: is this possible? Or do I always have to quit and restart the application? I know there are possibilities by using a workgroup file, but I prefer programming it all in one file...
Any help would be greatly appreciated. Thanx!
When I start my Access application I've created a login form. It connects to an employee-table and checks the username and password that's been filled in on the form. According to the user group (also stored in the table) I've created VBA-code to show or hide bars and menus. I'll show the example: (similar code has been posted several times at this forum, but I need to show it to make my question clear...)
----------------------------
Select Case Usergroup
Case 1 ' for example a guest account
Changeproperty "StartupShowDBWindow", DB_Boolean, False
Changeproperty "StartupShowStatusBar", DB_Boolean, False
Changeproperty "StartupShowDBWindow", DB_Text, "hoi"
Changeproperty "StartupShowStatusBar", DB_Boolean, True
Changeproperty "AllowFullMenus", DB_Boolean, False
Changeproperty "AllowShortcutMenus", DB_Boolean, False
Changeproperty "AllowBuiltinToolbars", DB_Boolean, False
Changeproperty "AllowToolbarChanges", DB_Boolean, False
Changeproperty "AllowBreakIntoCode", DB_Boolean, False
Changeproperty "AllowSpecialKeys", DB_Boolean, False
Changeproperty "AllowBypassKey", DB_Boolean, False
Function ChangeProperty(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer
Dim dbs As Object, prp As Variant
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
----------------------------
The code works fine, BUT only when I restart the application. However, that's not what I want. After pressing the login button I want to have the changes take effect instantly (so menus and bars should disappear).
My question: is this possible? Or do I always have to quit and restart the application? I know there are possibilities by using a workgroup file, but I prefer programming it all in one file...
Any help would be greatly appreciated. Thanx!