Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

'Enabled' Property for an Option Button within an Option Group

Status
Not open for further replies.

Bobsy

MIS
May 25, 2001
1
GB
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
 
You could try passing an OpenArg statement to the form and have the form investigate it's OpenArg value to decided which to enable/disable.

If
DoCmd.OpenForm "frmMaintenance", , , , , , "LockIt"

Then in your OnOpen event of frmMaintenance:

If Me.OpenArgs = "LockIt"
Me.Option14.Enabled = False
Me.Option16.Enabled = False
Me.Option18.Enabled = False
End If

HTH
Joe Miller
joe.miller@flotech.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top