Joseph Bupe
Joseph Bupe

Reputation: 77

Disable or hide button based on date condition in MS Access

I have a form that has a listbox and a subform. The listbox lists names of events, start date and end date. The subform bellow reveals names of participants to the event that is clicked in the listbox. Against each participant's name is a button to delete the participant.

How can I hide or disable the delete button if the start date of the event is past?

I will appreciate your help.

Joseph

Upvotes: 0

Views: 882

Answers (1)

Gustav
Gustav

Reputation: 55921

You can't as you cannot bind a button. So all buttons would be enabled or disabled.

You can use the OnClick event of the button:

If Me!StartDate.Value < Date Then
    MsgBox "Cannot delete a participant when start date is passed."
End If

Upvotes: 1

Related Questions