Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2006
    Location
    California, USA
    Posts
    55

    Unanswered: Highlight all Fields of a record with one field infocus

    Hi, Please give simple answers I am not a great programmer. ;-)

    I have a form. This form has records in rows. This form displays 5 fields per record of many records in the larger table.

    In each row, I have the fields in 5 text boxes... TB1, TB2... TB5

    I just want all 5 text boxes highlighted whenever any one of the 5 are being edited(infocus). That would basically appear to highlight the record row that is infocus..

    Can I use the 'conditional formatting' highlight the record that is 'infocus'? Can there be an expression for each text box that says something like ...

    ...If [TB1] hasfocus or if [TB2] hasfocus or if [TB3] hasfocus or if [TB4] hasfocus or if[TB5] hasfocus ... then set the color??

    Or maybe something like that. I just don't know code well enough to write that expression. Seems to me the conditional formatting should do it for me.

    Am I out of line here?

    Any help is appreciated.

    Floyd

  2. #2
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    Maybe this will help:

    To use the conditional formatting to highlight the current field(s) on a continous form, do the following...

    1. Create an unbound text box in the form header and call it txtCurrentRecord. You can set this field to invisible after you've confirmed it works. In the OnCurrent event of the form, enter code: txtCurrentRecord = me!MyRecID (your autonumber field).
    2. Then you can use the Conditional Formatting of (for example, MyRecID and/or your other fields). Make 2 conditions and set each Conditional Format condition to an expression...

    [MyRecID]=[Forms]![MyFormName]![txtCurrentRecord].....some background color (perhaps yellow).
    [MyRecID]<>[Forms]![MyFormName]![txtCurrentRecord].....some other background color (perhaps white).

    You don't really need [Forms!]![MyFormName] and can just enter: [MyRecID] = [txtCurrentRecord] instead. Do this for each field you want highlighted.

    Here's an example.
    Attached Files Attached Files
    Last edited by pkstormy; 07-29-07 at 22:47.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  3. #3
    Join Date
    Aug 2006
    Location
    California, USA
    Posts
    55
    Hi Paul,
    You did it again.. ;-) saved my bacon... I been working on this for days...
    The example was really helpful because I can actually see it and understand it in my own little way.
    Thanks again.
    Floyd

  4. #4
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    Thanks for the reply Floyd. I'm glad it works for you. I had to create the example as I was also curious.
    Last edited by pkstormy; 07-30-07 at 22:26.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •