Results 1 to 13 of 13
  1. #1
    Join Date
    Mar 2004
    Posts
    287

    Unanswered: Conditional Formatting

    Is there anyway using a Datasheet form that I can use Conditional formatting based on a field result.

    What I have is a Priority field which is either equal to 0 or 1 and if its 1 I would like to change the backcolor of the approrpriate record..

    Is there an easy way to do this?

    Thanks.

  2. #2
    Join Date
    Apr 2004
    Location
    Derbyshire, UK
    Posts
    789
    Provided Answers: 1
    Hi

    If you mean you are using a form in datasheet view then, in design view, select the field control to be formatted and from the menu Format -> Conditional Formatting...

    The rest should be self explanitory (perhaps with some tiral & error) ??


    MTB

  3. #3
    Join Date
    Mar 2004
    Posts
    287
    I know how to do that but how do i link the conditional formatting depending on another field, so if priority=0 then it changes the colour for 'NAME' etc etc

  4. #4
    Join Date
    Apr 2004
    Location
    Derbyshire, UK
    Posts
    789
    Provided Answers: 1
    Hi again

    select the NAME conrtol and in the conditional format dialoge select

    'Condition Is' from the cboListbox

    and enter in the next control the condition, something like

    [priority]=1

    (or [priority]=0 if that is the condition for formatting)

    and then select the formatting for this condition

    HTH


    MTB

    ps from memory this dosn't work with calculated fields only with data actualy held in a table, ie priority = 1 is stored in a table.
    Last edited by MikeTheBike; 04-13-07 at 07:55.

  5. #5
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    or better yet
    write some vba to handle the formatting in sa y a function
    call that function in several relevant places
    when the record changes, when the control changes,


    have a look at the events exposed by the various controls and the form to work out which events are relevant


    eg
    <mycontrolname>.onchange
    call myformattingfucntion()


    that way round you can do wahtever you want for as many conditions as you want, you are not limited to 3 conditions and a default that conditionmal formatting allows you, you can also set a hole batch of controls at the same time.
    I'd rather be riding on the Tiger 800 or the Norton

  6. #6
    Join Date
    Apr 2004
    Location
    Derbyshire, UK
    Posts
    789
    Provided Answers: 1
    If you do this in code, on a continuous form, won't it change all the controls for that field depending on the record selected ?

    MTB

  7. #7
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Quote Originally Posted by MikeTheBike
    If you do this in code, on a continuous form, won't it change all the controls for that field depending on the record selected ?

    MTB
    ...good point and well made.....


    ooops
    I'd rather be riding on the Tiger 800 or the Norton

  8. #8
    Join Date
    Mar 2004
    Posts
    287
    i can't really do this with code as the data is grab from elsewhere and not changed by the user so would want it to do all this autmatically

    i will try the ideas out now and let you all know how i get on.

  9. #9
    Join Date
    Mar 2004
    Posts
    287
    thanks that worked - i was selecting field value when it should of been EXPRESSION IS...
    Thanks very much for all your help!!!


    Although because i grab data from two different inboxes (exchange linked table) is there anyway to set a condition to change say the font colour if it comes from a particular table. (note: both tables are merged into TBL_Main for the actual form)

  10. #10
    Join Date
    Mar 2004
    Posts
    287
    or even better is there a way to see if the 'subject' (field name) has say DEEDS in the name - as all Deeds are from the DEEDS Inbox.

  11. #11
    Join Date
    Mar 2004
    Posts
    287
    I am using wildcards for Expression Is..

    [Subject]="Deeds*"


    But this isn't working, any idea's why not?

  12. #12
    Join Date
    Apr 2004
    Location
    Derbyshire, UK
    Posts
    789
    Provided Answers: 1
    Hi

    You can have upto 3 conditional formats specified for each control (use the Add>> button), so you can have a second condition Expession is' with 'equal to' specify 'DEEDS' as the condition.

    Not only one condition will be used (the first one that is true) so the oder of the conditions significant

    Just seen you last post, try [Subject] Like "Deeds*"

    MTB

  13. #13
    Join Date
    Mar 2004
    Posts
    287
    thanks that work. thanks for all the help guys

Posting Permissions

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