Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formatting Controls on Continious Form

Status
Not open for further replies.

TheFitz

Programmer
Dec 18, 2003
140
GB
Hi All,

Here's a good one for you.

I've got a report, which for each record,highlights fields depending on the values in that field, think Conditional Formatting, however, I have got this working for a number of different values, for example, I've used percentages in blocks of 10 as below:

0-10% - Colour = Dark Red
10-20% - Colour = Red
20-30% - Colour = Orange
30-40% - Colour = Yellow
40-50% - Colour = Lime Green
etc etc

I did this by using the OnFormat function of the report to read the value supplied and amend the information as required.

I want to include this functionality on a form, but given there's more than 3 "answers", Conditional Formatting isn't possible.

The form is a continious form.

I've tried the "OnCurrent" function, but this changes all fields on the form:
ie record 1, text 1 = Red
record 2, text 1 = Red

Where they should be:

record 1, text 1 = Red
record 2, text 1 = Yellow.

Can anyone help me - It's driving me bonkers!!!!!

Thanks for any help you can give,

Regards,

TheFitz


Fitz
Did you know, there are 10 types of people in this world:
* Those who understand binary
and
* Those who Don't!!
 
This cannot be done for more than 3 conditions. There is no way to do this in code, or conditional formatting using native Access capability. There may be a possibility using Windows API, but is extremely complicated and problematic. The only possible way to do this would be to build an unbound form. You could display say 25 records per form. You could then build the controls for 25 records. In theory this is doable, but depending on the complexity of the controls in a record, it may be very labor intensive. Then you could have buttons to scroll to the next 25 records. Since each control is a physical control (unlike a continous form where there is one set of physical controls and rendered images), you can use code to highlight as much as you want.
 
I use hidden bound txt boxes and VBA.
When txtHidden = whatever value then set the back color of the displayed text box.

Beir bua agus beannacht!
 
Code:
I use hidden bound txt boxes and VBA.
When txtHidden = whatever value then set the back color of the displayed text box.

No that can not be done, as already stated that will turn every rendering of that control on a continous form the same color. As I said, this cannot be done using vba code or conditional formatting on a continous form.
 
I've got a report...

Let be be a bit more clear, apologies for mis-speaking earlier.
This a report, not a continuous form.

txtBox with data set backstyle to transparent, format bring to front. Put on top of a box (rectangle control) backstyle = solid format send to back.
Change the color of the box in vba with select case or If...Then based on criteria in the bound text box. Works like a charm on six reports we have had in production for years. Similar to changing the color of the detail section using a backround box as discussed in the FAQs.
Good Luck!
[cheers]


Beir bua agus beannacht!
 
OK I guess, but the OP already stated that they had a working solution for the report. The question was how to do more than 3 conditional shadings on a continuous form. As stated this can only be done by making an unbound form or possibly using the windows API (not certain but I think Lebans has an API solution for conditional formatting for A97 and earlier which did not have native conditional formatting). It cannot be done is a similar manner to a report.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top