Enabling Field

dspinner

Registered User.
Local time
Today, 23:02
Joined
Sep 26, 2002
Messages
16
I want to enable or disable fields on a form based on information in the table. The second form opens from a button on the primary form. I have tried using a macro that runs when the secondary form opens, but have had no luck.

I use this under criteria:

[Forms]![Employees]![Status]="Student"

and have "Set Value" in the action to enable the field, which is set to disable by default

Any Suggestions?:confused:
 
Try passing in an OpenArgs

For example, if I have a button which opens a form as read only I will put on the On Click event:

Private Sub ReviewForm_Click()
DoCmd.OpenForm "ReviewForm", , , , , , "ReadOnly"
End Sub

On the form that opens I will put on the On Load event

Private Sub Form_Load()
If Me.OpenArgs = "ReadOnly" Then
Me.LastName.Locked = True
End If
End Sub

I use lock instead of enabled = false because Access sets a default color when a control is not enabled. If I set Locked = True I will also set the background color to something else.
 

Users who are viewing this thread

Back
Top Bottom