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!
 

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