Form button to highlight when their is a record present on another form

YNWA

Registered User.
Local time
Today, 23:45
Joined
Jun 2, 2009
Messages
905
Hi,

I have a form (main), for each record(patient), they have a contact against them (sub form contact). I have a button that opens a scores form when clicked. The scores form then relates back to that contact.

So all contact is 1-many with the scores.

Is it possible to have the Button (openScores) highlighted or show in a different colour only when the record related to that contact has records in the scores form.

Eg.

patient 1 has 5 contacts, each contact shows like this...

id, contactDate, notes, OPEN SCORES FORM BUTTON

When that scores form has data in it (relating back to that particular contact), I would like the scores form button to be hightlighted OPEN SCORES FORM BUTTON

Do people understand what I mean?

The reason behind this is, the contact form contains loads of contacts, each shows on the form with the Open scores button on it. When users then try to find a contact with a score, they need to click each button to biew the score form to see if there is any data inside.

By highlighting the buttons if there is data relating to that contact or contactID, it will be easier for users to see which contacts have the scores in and which do not.

Thanks
Will
 
You could use the on current event of the main form to do a count on the contacts by patient table and if it finds any it enables the view contacts button otherwise it disables it. In other words users can only view contacts if they exist. You could go a step further and change the forecolor of the button (text) but you would have to reset it after each event.
 
I was thinking along the lines of Conditional Formatting using a DCount() in the Expression Is selection.
 
I do something similar to this. I have an unbound text box at the top of the form that I made look like a label. I set its Control Source to =DCount("Your Field","Your Query or Table")

Ths shows the number of records in a query or table. You can use this with the main forms on current event. See the link below about the function.

http://www.techonthenet.com/access/functions/domain/dcount.php
 
Cheers all.

THought it might be best to attached what I have.

If you enter a record as normal, then click on the "Referrals and Contacts" tab.

Enter the referral info, then enter contact info.

Next to the contact info is a "Open Form" button. This is the button I want highlighting if there is any info in the form.

So enter 2 contacts, then on 1 contact click the Open Form button and enter info. That data now relates to that contact.

What I want to happen is the Open Form for that contact to now show Purple or red or whatever because there is data relating to that contact now. The other Open Form button on the other contact should remain as it is as there is no info relating to it.

Do you get what I mean?

Cheers
Will
 

Attachments

Oh it's for a button! You would have to follow what DCrake explained. You could even use a textbox to display the number of related records instead.
 
Right I see.

But this isn't for patients and contacts, its for contacts and then socres (this is what the Open Form button opens).

The user then enters problem scores that relate to that contact.

I need the button visible always even if no scores are present, because the user would need to enter scores for any contact at any time. So the open form button allows them to do that.

If I was to break it down, I need this...

If contactID from the scores table = contactID from the contacts table then make Open Form button Purple.

I dunno really, lost at this point.
 
Hmm... just had another look at your db and it seems I was looking at the wrong button. You're talking about the Open Form button on the continous form right? What you're trying to do wouldn't work with code so as mentioned in my first post you need conditional formatting for this but you would have to use a textbox for this. The textbox will replace the button.
 
Hmm... just had another look at your db and it seems I was looking at the wrong button. You're talking about the Open Form button on the continous form right? What you're trying to do wouldn't work with code so as mentioned in my first post you need conditional formatting for this but you would have to use a textbox for this. The textbox will replace the button.

Yeah the Open Form button on the continuous contacts form.

Do I create a text box (called txtValidate), then do a DCount on it to look up something in the scores form and if found format the button?

Any examples?
 

Users who are viewing this thread

Back
Top Bottom