Hi,
I have two forms set up as Menu's within my database, one which is accessible by all users and the other (frmMaintenance) allows access to the underlying tables. I have restricted access to frmMaintenance by using a simple form which asks for a password before opening frmMaintenance. I want to add further restrictions by supplying users with two possible passwords, one allows full access to all options on frmMaintenance, the other will 'disable' some of the options.
frmMaintenance has a number of Option Buttons set-up as an Option Group but for some reason, Access is not recognising my code to 'disable' certain Option Buttons within the Group.
My code is as follows:
Private Sub txtPassword_AfterUpdate()
If txtPassword.Text = "User1" Then
DoCmd.OpenForm "frmMaintenance", , , , , , ""
DoCmd.Close acForm, "frmPassword", acSaveNo
ElseIf txtPassword.Text = "User2" Then
DoCmd.Close acForm, "frmPassword", acSaveNo
DoCmd.OpenForm "frmMaintenance", , , , , , ""
Forms!frmMaintenance!Option14.Enabled = False
Forms!frmMaintenance!Option16.Enabled = False
Forms!frmMaintenance!Option18.Enabled = False
Else
MsgBox ("Sorry, password not recognised", 48
DoCmd.Close acForm, "frmPassword", acSaveNo
DoCmd.OpenForm "Main Form"
End If
End Sub
The Error message reads "The Setting you entered isn't valid for this property".
Does anyone have any ideas where I'm going wrong?
Any help would be much appreciated.
Thank you
I have two forms set up as Menu's within my database, one which is accessible by all users and the other (frmMaintenance) allows access to the underlying tables. I have restricted access to frmMaintenance by using a simple form which asks for a password before opening frmMaintenance. I want to add further restrictions by supplying users with two possible passwords, one allows full access to all options on frmMaintenance, the other will 'disable' some of the options.
frmMaintenance has a number of Option Buttons set-up as an Option Group but for some reason, Access is not recognising my code to 'disable' certain Option Buttons within the Group.
My code is as follows:
Private Sub txtPassword_AfterUpdate()
If txtPassword.Text = "User1" Then
DoCmd.OpenForm "frmMaintenance", , , , , , ""
DoCmd.Close acForm, "frmPassword", acSaveNo
ElseIf txtPassword.Text = "User2" Then
DoCmd.Close acForm, "frmPassword", acSaveNo
DoCmd.OpenForm "frmMaintenance", , , , , , ""
Forms!frmMaintenance!Option14.Enabled = False
Forms!frmMaintenance!Option16.Enabled = False
Forms!frmMaintenance!Option18.Enabled = False
Else
MsgBox ("Sorry, password not recognised", 48
DoCmd.Close acForm, "frmPassword", acSaveNo
DoCmd.OpenForm "Main Form"
End If
End Sub
The Error message reads "The Setting you entered isn't valid for this property".
Does anyone have any ideas where I'm going wrong?
Any help would be much appreciated.
Thank you