Link to home
Start Free TrialLog in
Avatar of Howard Bash
Howard BashFlag for United States of America

asked on

Access 2007 How to Color Selected Row in VBA

I am looking for a snippet of code demonstrating how to set a selected row to a color.

Please advise.
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

By "row", do you mean a row in Datasheet view? If so, you'll have to use Conditional Formatting. The help topic is pretty thorough about the mechanics of this. The simplest way is to include a label or rectangle control that enclosed your entire Detail section, then set the Controls to all transparent backgrounds, then use CF to color the lable or rectangle.
Avatar of Howard Bash

ASKER

Yes, I mean the datasheet view.  I am not clear at all about using a label or rectangle control.  Do you mean to dynamically place a label over the selected row and set it's color?

If you could provide either a complete description, example, or reference to an example that would be great.  

Also, not sure about the Help Topic to search on ... "Color datasheet row",  "Using a label to color a row in a datasheet",...


Thanks.
You can't do that in Datasheet view (the rectangle or lable trick, that is) - I should have specified that this was for Continuous forms.

You'll have to apply formatting to each control on the Datasheet view. You'll do this in Design view - open the form in Design view, select a control, then click Format - Conditional Formatting. You can get to the help topic from there.
ASKER CERTIFIED SOLUTION
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I would have preferred the solution to be in Access2007.  But as long as the same principles can be applied in 2007... thanks.