G
GDW
I'm trying to enable/disable controls on a datasheet based on the value
of another field/control on each record. The problem that I'm having
is not being able to access the controls specific to each record. What
happens is that the controls end up being either all enabled or all
disabled. There are 2 parts to what I'm trying to do: 1) setting the
initial state of the controls (DRFID in the code below) when the form
first opens or is switched to datasheet view and 2) changing the state
of DRFID when the DRFCompleted checkbox is clicked. BTW, this form is
a subform (I don't know if that matters).
Any help would be appreciated - Gary
Here's the code:
Private Sub DRFCompleted_Click()
Me.DRFID.Enabled = Me.DRFCompleted
End Sub
Private Sub Form_Current()
On Error GoTo Exit_Form_Current
If Me.ActiveControl.ControlName = "DRFID" And Not Me.DRFCompleted
Then
Me.DRFCompleted.SetFocus
End If
Me.DRFID.Enabled = Me.DRFCompleted
Exit_Form_Current:
Exit Sub
End Sub
of another field/control on each record. The problem that I'm having
is not being able to access the controls specific to each record. What
happens is that the controls end up being either all enabled or all
disabled. There are 2 parts to what I'm trying to do: 1) setting the
initial state of the controls (DRFID in the code below) when the form
first opens or is switched to datasheet view and 2) changing the state
of DRFID when the DRFCompleted checkbox is clicked. BTW, this form is
a subform (I don't know if that matters).
Any help would be appreciated - Gary
Here's the code:
Private Sub DRFCompleted_Click()
Me.DRFID.Enabled = Me.DRFCompleted
End Sub
Private Sub Form_Current()
On Error GoTo Exit_Form_Current
If Me.ActiveControl.ControlName = "DRFID" And Not Me.DRFCompleted
Then
Me.DRFCompleted.SetFocus
End If
Me.DRFID.Enabled = Me.DRFCompleted
Exit_Form_Current:
Exit Sub
End Sub