Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 12th, 2005, 08:36 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default Conditional Formatting on Subform

Hi Everyone,

I was probably up too late last night working on this one, because my brain isn't working this morning - I have a subform that I have set as a continuous form and I would like to set the background color for each record on that form based on values which it is pulling. e.g. If combobox=1 color=blue, if combobox=2 color=red. Anyone know how best to accomplich this?

Thanks in advance

Mike

Mike
EchoVue.com
__________________
Mike
EchoVue.com
 
Old September 12th, 2005, 11:21 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 471
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hiya Mike!,

How many values are possible? I spent the last couple of hours and figured out the way to do it, but you have to conditionally format each field on the subform based on the value.

right click on the field you want to change the color on and pick the condition formatting and you'll see what I mean.

Kevin

dartcoach
 
Old September 12th, 2005, 11:55 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 471
Thanks: 0
Thanked 1 Time in 1 Post
Default

Mike,
I forgot, you have to use the format in the isexpression code:

combobox.value=1

Kevin

dartcoach
 
Old September 12th, 2005, 10:15 PM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Hi Kevin,

Sorry, It has been one crazy day. Thanks your solution helped out. I was having some trouble getting all the controls to change their colors (probably related to the late night) but what I ended up doing was setting a textbox to fill the size of the whole detail section, and set it behind everything else. I then set all the other fields to transparent, and set the data source of the big text box to a field containing the key variable, and set both the text and the background to the same color. It has worked out well - I'll have to send you a copy of it once I get done.

Thanks again,

Mike

Mike
EchoVue.com
 
Old March 3rd, 2006, 03:25 AM
Registered User
 
Join Date: Mar 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

G'Day Fellas

I have exactly the same requirements (i think) as Mike. I have a form that will contain a detail section to return quite a few records. What I am trying to achieve is one colour per row based on a value returned in each row.
Background:
    Each record represents a customer request
Depending on the whether the request has been completed, responded to or simply plain forgotten, (and this will be determined by a difference in two dates), I would like to colour the entire row (which contains a number of textboxes) a certain colour. ie If the request has just been received and is within the response time (ie 5 days), then I'd colour this row green. On the other hand, if the request had been received two months ago and someone simply failed to respond to it, i would like to colour this entire row red.
Esentially, the users will be able to open the form and dbl click on a record to open the item.

I'd really like to know what your solution was because I've tried the following:
the detail section contains a number of txtbox controls pulled from the field list. I got rid of the labels associated with them.
I've strung them across the detail section.
On the form_open event, I set the width of the first control to cover all the other controls. In the designer, I "sent to front" all of the other controls in the detail section and sent to back the first control.
Likewise, I also set the properties of the other controls to transparent.
Problem is, I need to write some logic to test "each record" for its value that will determine its background colour. Can I do this in the form_open event or what?...

thanks kindly

Grant Williams
Australia





Similar Threads
Thread Thread Starter Forum Replies Last Post
Conditional Formatting on report in Access bronen Access VBA 3 August 1st, 2008 07:33 AM
conditional formatting jeremy1048 Access 4 July 3rd, 2008 11:20 AM
Conditional formatting vemaju Excel VBA 2 June 6th, 2007 04:41 AM
Conditional Formatting Corey Access 1 November 8th, 2005 12:18 AM
Conditional Formatting... In Access??? lguzman Access VBA 2 September 23rd, 2004 03:52 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.