Avatar of Sandra Smith
Sandra Smith
Flag for United States of America asked on

If row type is New, set a controls' background to different color from other rows on an Access 2003 Report

I only the udpate text control to change its background color if the type for that row is "new".  So, I have three controls in the detail, Task Title, Update and Type,  If the Type is "new", I want the background for Update to be blue - is this even possible?  That is, change the background for one control in a row based on a value of another control in that row?
Microsoft DevelopmentMicrosoft ApplicationsMicrosoft Access

Avatar of undefined
Last Comment
Sandra Smith

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
pteranodon72

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Sandra Smith

ASKER
I copied your code directly into the report, but does not work.  
Sandra Smith

ASKER
I am thinking that since this is a report, perhaps it actually cannot be done?  that is, format woud be at the row level, not a control level within the row?
pteranodon72

It's totally possible, but just pasting the code may not connect it automatically. To be sure:

Open the report in design view. Press F4 to show the Properties list if it is not showing already. Click on the Detail section (not Report Header, Page Header, any footer, or any control. On the Events tab of the Properties list, look at On Format. Drop down the box and choose [Event Procedure]. Then press the . . . button. This will open the VBA editor. The function skeleton will be laid out for you.

The Detail section's OnFormat event fires one or more times for each record in the report.
Don't worry about the reasoning for the outer If-End If.
You'll need to adjust the syntax of lines 3 - 7 to match the names of the textboxes on your Report.

HTH,
pT72
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
pteranodon72

It's possible that pasting the code straight into the module without compiling it may not set the OnFormat property of the Detail section. However, following the above events should "wire" the code to the actual event. Also, in re 36320030, the Detail_OnFormat occurs once or more before any control within it is drawn (print preview) or printed. It's not too late, I assure you.

pT72
SOLUTION
Jeffrey Coachman

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Sandra Smith

ASKER
Let me try again and unfortunately, they are still on ACCESS 2003.
Sandra Smith

ASKER
I have not forgottent his question, just had a slight medical emergency and have been out of the office.  Will address this when I get into work tihs morning.  Sorry about the time lapse.  Now, does anyone know how long it takes to heal a broken leg, arm and two toes??
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Jeffrey Coachman

See here

;-)
Sandra Smith

ASKER
Thank you both!  I used code from pterrandon72 and the points noted by Jeff got it to work.  This actually now helps to make some other reports more indicative with color as well.  

Sandra

Also, thank for the doctor info, great, 6 months of hobbling......