(Conditional Formatting) referencing indivdual records on a continuous form

Heythere82

Registered User.
Local time
Today, 14:52
Joined
Feb 17, 2016
Messages
14
Hi Everyone

I have a continuous form feeding from a query. The query lists incidents and new incidents are being adding to the database frequently.

One of the fields listed on the form will be the Status field -- either "Open" or "Closed".

If the status is listed as "Open", I would like some sort of formatting change on that row on the continuous form.

Maybe the color of that row/entry could change to red.

Maybe the text of that row/entry could be bolded.

The specific formatting is not necessarily important. I'm guessing that I would just change the form property using an IIF statement.




The problem I'm facing is how do I reference a specific record on the continuous form?

If I have VBA code running with a timer event on the form, the code would only check the current(active record), not all 10 records displayed on the continuous form.


Similarly, if the current record is listed as "Open", I could only change the formatting for the entire form, not that specific record.

So, is there a way to reference specific records on a continuous form?

Is there another way of greatly distinguishing "Open" records from the others on my form?


I have been stuck with this problem for so time now. I cant figure out a solution. :banghead::banghead::banghead:
 
It can't be done in VBA. Use ConditionalFormatting. (Right click on a control.)

Enter an "Expression Is" condition.

Copy the control and Use Paste Formatting to all the others.
 
As Galaxiom said, doing almost any kind of formatting in a Continuous Form requires using the Conditional Formatting Wizard. The simplest thing, in this scenario, would be to change the Back Color of the Status Control, using, Conditional Formatting.

In Form Design View:
  1. Right-Click on the Status Control
  2. Click on Conditional Formatting
  3. Under Condition 1 select Expression Is from the Drop Down
  4. In the box to the right type [StatusControlName] = "Open" (you must use the Square Brackets as shown)
  5. Click on whatever Formatting you want
  6. Click OK.
Your Formatting Options will be B(old)/I(talics)/U(nderline)/BackColor/(Paint Bucket)/ForeColor (a Big A).

You could do the same for all of the Controls, in one fell swoop:
  • Press and hold down the <Shift> Key
  • Click on each Control you want to Format to select it
  • Right-Click
  • Click on Conditional Formatting
  • Repeat Steps #3 - 6, above

There are hacks out there for:
  1. Placing a Textbox, under all of the Controls.
  2. Binding it to a Field in the underlying Table/Query
  3. Leaving it unpopulated
  4. Sending it to Back
  5. Right Clicking on the Textbox
  6. Clicking on Conditional Formatting
  7. Repeating Steps #3 - 6, above

I've seen this done, but never thought it looked very professional, to be honest. But, as they say in the ads, your results may vary! ;)

Linq ;0)>
 
There are hacks out there for:
  1. Placing a Textbox, under all of the Controls.
  2. Binding it to a Field in the underlying Table/Query
  3. Leaving it unpopulated
  4. Sending it to Back
  5. Right Clicking on the Textbox
  6. Clicking on Conditional Formatting
  7. Repeating Steps #3 - 6, above

How can the textbox be unpopulated if it is bound to a recordset field? I expect it would require a Null field returned in the RecordSource query and bind the textbox to it.

Then use an Expression Is ConditionalFormat on the background textbox to make it respond to values in one of the controls.

The BackStyle of the controls would need to be Transparent too or they would obscure the background formatting.
 
[/LIST]

How can the textbox be unpopulated if it is bound to a recordset field?
Unpopulated simply means that it holds no data...so yes, it would be Null. And you're undoubtedly right about the other; it's something I've never cared to try...just threw it in as a possibility..

Linq ;0)>
 
Thanks Linq!

The conditional formatting worked perfectly.
 
Last edited:
I'm trying to do something just like this except that I am using disabled text boxes.

How can I implement this but keep the controls disabled after applying conditional formatting?

Or, can this be accomplished using code?
 
I'm trying to do something just like this except that I am using disabled text boxes.

Try experimenting with the Locked Property instead.

Also note that Locked = True and Enabled = False used together render differently too.
 
Using Locked vs. Enabled will work for my purposes although it's not ideal.

Thanks, Galaxiom for the tip.
 

Users who are viewing this thread

Back
Top Bottom