Conditional Format All Fields in ACTIVE record

esipp

Registered User.
Local time
Today, 00:53
Joined
Nov 5, 2004
Messages
29
:D I am using a continuous form, and I cannot figure out what conditional formatting expression to use to change controls in the ACTIVE RECORD.

For example, continuous form may have:

RECORD1: Field 1 Field 2 Field 3 Field 4
RECORD2: Field 1 Field 2 Field 3 Field 4
RECORD3: Field 1 Field 2 Field 3 Field 4

When I am in Field 1,2,3, or 4 in RECORD2, I want Fields 1,2,3 AND 4 to change color in RECORD2

PLEASE HELP!
 
Thanks for the link. This does what I want, for sure, yet it is so convoluted and code intensive. My database is getting too big and slow. Is there no simpler way to do this? For example, some kind of "me.currentrecord" statement in the Conditional Formatting box?
 
Here's my method

esipp said:
Thanks for the link. This does what I want, for sure, yet it is so convoluted and code intensive. My database is getting too big and slow. Is there no simpler way to do this? For example, some kind of "me.currentrecord" statement in the Conditional Formatting box?

This is what I do:

1. In the subform, set up an unbound textbox, call it: txtActive

2. Be sure to include the Primary key of the record in the subform, make it invisible (let's call it txtPK).

3. On the Main field of the subform: in the GotFocus Event:

Code:
Me.txtActive = Me.txtPK

4. do the same for the GotFocus Event of the rest of the fields in the Subform

5. Using conditional formating in one of the fields:

Expression

[txtActive] = [txtPK]

Change the colors and font as you wish and press OK

6. Clone the Changes using the format painter (Paint brush) Tool


Now: This is what is happening, when a record becomes Active (get focus) the Primary Key value passes to our Select text box and that being equal to the actual value of the record's Id the entire row changes color.

This approach has several advantages, the conditional formating stays on the
record even if a button, for example, got focus.

I base all the transactions, Edits, opening new forms, etc in the value of the unbound box, not the actual PK of the subform.

Let me know If I was clear.
 
BRILLIANT! THANK YOU!

I have a general question: since my application is getting bulky and SLOW... how does this coding affect its speed? What causes an application to slow down the most?
 
esipp said:
BRILLIANT! THANK YOU!

I have a general question: since my application is getting bulky and SLOW... how does this coding affect its speed? What causes an application to slow down the most?

Well I have used other methods to select records on subforms, including checkboxes, and this one seems require the least amount of processing power.

There are many threads here about how to increase performance on a DB, most of them are just personal preferences, but there are some that are a must:

1. Split the Db, front end /back end

2. Back end on File server, Front end on Client's PCs

3. Compact and repair frequently, DBs bloat and defragment just like Hard drives, (look for a way to Autocompact a database on selected criteria in the forum. Keyword: Autocompact)

4. Clean your code, think how to make it more efficient, use stored queries instead of SQL in the processess that are performed by several users at the same time, they are faster. Avoid Dlookups, Dim all variables/ Close and Clean all open recordsets. Even though it is against most rules, I take all comments on the code on the Db that I release, those comments are read by the computer everytime a procedure is done. Not all code has to be commented - see point 5.

5. Debug and Compact your code, even more, create an MDE, that will keep all the code compacted. No user/developer will be able to access the code from there, why have it commented?

6. This is a big one: Keep all tables that dont change (lookup tables)Local on the Front end, or better, on another local Db and link them to your Front End Db.

7. Check your queries, pull Just the data you need, nothing more, nothing else. All that info has to travel through the Network every time you open a form/report etc.

8. Consider archiving, that is moving old/Unsued Records, to another Db, you can design ways for them to access that info in case they need it.
 

Users who are viewing this thread

Back
Top Bottom