Avatar of Ross
RossFlag for United Kingdom of Great Britain and Northern Ireland

asked on 

MS Access - conditional format a command button

I have a continuous form that has a command button on it that opens another form (based on a query on another table) where the PK of the first form and second form match, so the second form only shows data relating to the record we're on in the continuous form.

What I want to achieve is for the command button to be a different colour to normal if there is any records found for the second form - IE, if there's no linked data from the query, leave the button normal, if there's any records found in the query (that would be shown in the form) then the button should be a different colour.

I hope I've explained myself clearly enough!

Thanks!
Microsoft Access

Avatar of undefined
Last Comment
Ross
Avatar of MINDSUPERB
MINDSUPERB
Flag of Kuwait image

You might not get what you want for a continuous form. You may have only one button and displayed as many times as the records you have in a form. The properties of that button are carried out to the replicated buttons.

So, if you implement a code to change any property e.g. forecolor of the button, the same property is applied to all.


Ed
Avatar of Ross
Ross
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

can i not change the way i'm doing it a little by using onfocus for the current record to set the button colour when the record is entered? IE default all buttons to "normal" when that record is entered it's button changes?

Thanks!
Avatar of MINDSUPERB
MINDSUPERB
Flag of Kuwait image

I don't think so.

I say that because if you call that button in a code, you are referring to the same button.

Ed
Avatar of Ross
Ross
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

even with Me!Button?
Avatar of MINDSUPERB
MINDSUPERB
Flag of Kuwait image

Yes, that is what I know.

Ed
ASKER CERTIFIED SOLUTION
Avatar of MINDSUPERB
MINDSUPERB
Flag of Kuwait image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Ross
Ross
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

thats a good solution - didn't think of that. Just means it's not "perfect" but I can educate the users that the effect is the same thing :) Ideal!

Cheers.
Microsoft Access
Microsoft Access

Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.

226K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo