PC Review


Reply
Thread Tools Rate Thread

Disabling a Button Based if a related record does not exist

 
 
New Member
Join Date: Nov 2009
Posts: 4
 
      29th Mar 2010
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!
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Automatically fill in field of a new record, based on related reco Tammy Microsoft Access Forms 6 5th Jun 2008 06:34 PM
Update table record based on calculations from related subform =?Utf-8?B?Y2Vz?= Microsoft Access 1 16th Dec 2005 06:20 PM
Add new record(fk) to a related record(pk) from cmd button event =?Utf-8?B?TWFyeUY=?= Microsoft Access Form Coding 0 20th Jul 2004 12:19 AM
disabling cells based on cmd button Consuelo Microsoft Excel Programming 1 20th Sep 2003 09:44 AM
Re: Disabling a button based on data JoeElla Microsoft Access Forms 1 29th Aug 2003 06:12 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:08 AM.