Enable/disable subdatasheet control

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
 
S

Steven M. Britton

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top