Enable/disable subdatasheet control

  • Thread starter Thread starter Mary
  • Start date Start date
M

Mary

On which event do I place the code to enable/disable a
subdatasheet control depending on the value of a field in
the main form? When I place it in the subds.enter event
it works the first time but subsequently gives a "You
can't disable a contol that has the focus" even when the
focus has been returned to the main form. Thanks for
your help,
Mary
 
In the On Open Event in the main form have an if then else
check the value of the field you want to use to
enable/disable the sub form.

Private Sub Form_Open(Cancel As Integer)
If Me.Date = Date Then
Me.btnAppendOrders.Enabled = False
Else
Me.btnAppendOrders.Enabled = True
End If
End Sub
 
Back
Top