Results 1 to 1 of 1
  1. #1
    Join Date
    Dec 2003
    Budapest, HU

    Unanswered: Using FormatCondition object in VBA

    Hi Everybody,

    I have a continuous form with several fields bound to a table containing a couple of thousand of records.

    I'd like to cahnge the color of a field for records returning False for a specified expression.

    I know, that conditional formatting is available from VBA code by declaring and creating a FormatCondition object and add this object to the control's FormatConditions collection. That's clear for me, I have no problem with that, the code is:
    Dim fmc As FormatCondition
    Set fmc = MyControl.FormatConditions.Add(acFieldValue, acNotEqual,"MyValue")
    fmc.BackColor = vbRed
    My problem is, that it works properly ONLY if I put an exact value in the third parameter. If I put a function there that returns a string value, then the comparison runs ONLY for the first record, and, token the example above, if the first record becomes red then all records become red. if it doesn't, then the other records also don't.
    I tried it in this way:
    Set fmc = MyControl.FormatConditions.Add(acExpression, ,MyControl <> MyFunction([parameter_list]))
    but the same result returns.

    Does anyone any idea to work it out?


    Last edited by TBÁrpi; 12-09-03 at 19:46.

Posting Permissions

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