Conditional Formatting (for CURRENT Record !

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Prakash Wadhwani

    Conditional Formatting (for CURRENT Record !

    I have 3 fields : First_Name, Last_Name & Policy_Number

    I'm using a continuous form.

    If I invoke conditional formatting on First_Name & set a condition of
    "Prakash" (change the foreground to red), it works fine.

    My Problem:
    ----------
    What I'd like to do however is change the color of the foreground for
    the CURRENT RECORD !! So That ... as I move the record pointer from
    record to record, the the foreground of all three fields are red.

    I have gone through the NG and noticed it is also possible to do this
    using VBA code. Can someone please explain both methods of going about
    this (one ... the point & click method) ... and the other (using VBA)
    .... with a code example.

    Thx & Best Rgds,
    Prakash.
  • Fredg

    #2
    Re: Conditional Formatting (for CURRENT Record !

    Did you check out


    --
    Fred

    Please reply only to this newsgroup.
    I do not reply to personal e-mail.


    "Prakash Wadhwani" <simran@omantel .net.om> wrote in message
    news:6025a525.0 311102046.4b3a8 e99@posting.goo gle.com...[color=blue]
    > I have 3 fields : First_Name, Last_Name & Policy_Number
    >
    > I'm using a continuous form.
    >
    > If I invoke conditional formatting on First_Name & set a condition of
    > "Prakash" (change the foreground to red), it works fine.
    >
    > My Problem:
    > ----------
    > What I'd like to do however is change the color of the foreground for
    > the CURRENT RECORD !! So That ... as I move the record pointer from
    > record to record, the the foreground of all three fields are red.
    >
    > I have gone through the NG and noticed it is also possible to do this
    > using VBA code. Can someone please explain both methods of going about
    > this (one ... the point & click method) ... and the other (using VBA)
    > ... with a code example.
    >
    > Thx & Best Rgds,
    > Prakash.[/color]


    Comment

    • Larry  Linson

      #3
      Re: Conditional Formatting (for CURRENT Record !

      The class code may be complicated, but it may not be complicated to _use_
      them. That is one of the primary benefits of using classes, to hide the
      complexity and make the objects simple to use.

      I'll bet we would be _astonished_ at how complex an object like a Form is,
      behind the scenes, but it's pretty easy to use. In fact, the Form class is
      coded in a different language, C++, but we can use it in VBA and with
      point-and-click.

      I'd suggest taking another look at Stephen's work, to see if there isn't a
      very simple way to _use_ it. I'd wager there _is_.

      Larry Linson
      Microsoft Access MVP

      "Prakash Wadhwani" <simran@omantel .net.om> wrote in message
      news:3fb08dd3$0 $195$75868355@n ews.frii.net...[color=blue]
      > Hi Fred !
      >
      > Yes I did check out Stephen's Site. Unfortunately he has used classes
      > which I know nothing about & hence find it a bit complicated and am a
      > wee bit hesitant to use it.
      >
      > Secondly, he has colored the row outside the text editing area. I wish
      > to color the foreground of the text (he probably has that too ... I
      > don't recollect). He's put up so many examples.
      >
      > Thirdly, I would like to accomplish this using the point & click
      > facility available for conditional formatting in Access ... or ... using
      > VBA ... eg:
      >
      > ---------
      > With Forms("MyForm") .Controls("tbCf Text").FormatCo nditions _
      > .Add(acFielsVal ue, acGreaterTyhan, "=[tb2]")
      > .BackColor = RGB(224,224,224 ) ' pale Gray
      > .FontBold = True
      > .ForeColor = RGB(64, 32,160) ' blue with a hint of purple
      > End With
      > ----------
      >
      >
      > I would greatly appreciate if someone could explain the above lines to
      > me & demonstrate how I could change the above code to change the
      > foreground color of only the CURRENT RECORD ! and ... how it can change
      > as I move from record to record.
      >
      > As a last resort if I can get nothing else to work, I may have to opt
      > for Stephens' Solution. It's just that I don't like incorporating code
      > in my programs which I don't understand. Stephen really has put up tons
      > of beauties at his site within the public domain. (God bless him !)
      >
      > Thx & Best Rgds,
      > Prakash.
      >
      >
      >
      >
      >
      >
      >
      >
      > *** Sent via Developersdex http://www.developersdex.com ***
      > Don't just participate in USENET...get rewarded for it![/color]


      Comment

      • Prakash Wadhwani

        #4
        Re: Conditional Formatting (for CURRENT Record !

        Larry, I certainly will look into Stephen's Classes once again as
        suggested by you. Could you however also *please* explain to me the
        following code & how to implement it for the CURRENT record ... i'd
        really appreciate that.

        Also ... in which event would I need to place this code ? (probably
        current event ... i'm guessing) ??


        ---------[color=blue]
        > With Forms("MyForm") .Controls("tbCf Text").FormatCo nditions _
        > .Add(acFielsVal ue, acGreaterTyhan, "=[tb2]")
        > .BackColor = RGB(224,224,224 ) ' pale Gray
        > .FontBold = True
        > .ForeColor = RGB(64, 32,160) ' blue with a hint of purple
        > End With
        > ----------[/color]

        Thx & Best Rgds,
        Prakash.


        *** Sent via Developersdex http://www.developersdex.com ***
        Don't just participate in USENET...get rewarded for it!

        Comment

        • Larry  Linson

          #5
          Re: Conditional Formatting (for CURRENT Record !

          Prakash,

          The continuous forms view simply does not support the use of the code you
          posted. That was the reason that Conditional Formatting was added to Access
          in Access 2000, and why Stephen created his workaround code/class.

          There is only one "detail" defined in the continuous forms view, so certain
          operations apply to every copy of it that is displayed. Only one of those
          copies, BTW, is active; all the rest are just painted on the screen to show
          additional bound records. This is the same reason that an unbound Control
          will display the same value for every "record" displayed in continuous forms
          view.

          Larry Linson
          Microsoft Access MVP

          "Prakash Wadhwani" <simran@omantel .net.om> wrote in message
          news:3fb13441$0 $195$75868355@n ews.frii.net...[color=blue]
          > Larry, I certainly will look into Stephen's Classes once again as
          > suggested by you. Could you however also *please* explain to me the
          > following code & how to implement it for the CURRENT record ... i'd
          > really appreciate that.
          >
          > Also ... in which event would I need to place this code ? (probably
          > current event ... i'm guessing) ??
          >
          >
          > ---------[color=green]
          > > With Forms("MyForm") .Controls("tbCf Text").FormatCo nditions _
          > > .Add(acFielsVal ue, acGreaterTyhan, "=[tb2]")
          > > .BackColor = RGB(224,224,224 ) ' pale Gray
          > > .FontBold = True
          > > .ForeColor = RGB(64, 32,160) ' blue with a hint of purple
          > > End With
          > > ----------[/color]
          >
          > Thx & Best Rgds,
          > Prakash.
          >
          >
          > *** Sent via Developersdex http://www.developersdex.com ***
          > Don't just participate in USENET...get rewarded for it![/color]


          Comment

          Working...