Disabling a Button Based if a related record does not exist

Joined
Nov 14, 2009
Messages
4
Reaction score
0
Hello,

I have a button (View_Project_Details) that I would like to disable on a form if a related child record on the Project_Spec_Details table does not exist. Basically I have created a form that searches the parent table for projects. If the end user is able to drill down to see more information I want the button available for them to do so. But...if the related child record doesn't exist, I want the button on the first form disabled.

Can someone please tell me how to do this? I have some code below but I'm getting the 'object required' error and I'm fairly certain my If/Then syntax is wrong.

Private Sub Open_Details_Form_Click()
If DCount("*", "Project_Spec_Details") = "0" Then
View_Project.Enabled = False
Else
View_Project.Enabled = True
End If
End Sub

Thank you so much!
 
Back
Top