Results 1 to 6 of 6
  1. #1
    Join Date
    May 2006
    Posts
    386

    Unanswered: Need Urgent Help in Conditional Formatting

    HI All,

    I hope you someone would be able to help. I have the following field names on my form and below is what I want to do through Conditional Formatting or any other possible ways:

    DateOfJob
    DateReceived

    Requirement: If DateRecevied is Greater by 6 days From DateOfJob, THEN Background Colour of DateReceived should become Red, AND IF DateReceived is Greater by 10 days from DateOfJOb then Background Colour of DateReceived field should become yellow.

    Basically, I am not that good with coding so would highly appreciate examples please.
    Emi-UK
    Love begets Love, Help Begets Help

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    so use the datetiem functions (Im guessing datesub, or possibly dateadd)
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    How about DateDiff?

    1. In Form Design View, Right Click on the DateRecevied Control
    2. Click on Conditional Formatting
    3. Under Condition1 select Expression Is
    4. In the next box enter DateDiff('d',[DateRecevied], [DateOfJob])>6
    5. Choose your formatting (use the 'bucket' icon for Back Color)
    6. Under Condition2 select Expression Is
    7. In the next box enter DateDiff('d',[DateRecevied], [DateOfJob])>10
    8. Choose your formatting
    9. Click on OK
    I'm not really clear about which field is supposed to come first, so you may have to switch them around in the DateDiff expressions.

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    Join Date
    May 2006
    Posts
    386
    Thank you all.
    I had to swap the dates and it worked fine for the >6 but it is not working if DateReceived is equal to or greater than 10 days from the DateOfJob.

    Kindly help me out on this.
    Emi-UK
    Love begets Love, Help Begets Help

  5. #5
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    so what have you actually tried?
    its no different to an If statement, you just need to structure it correctly

    if all else fails you can achieve this using some code int he detail on format, or control on format events

    ...and Missinlinq is bang on... its datediff NOT dateadd/dateSub
    I'd rather be riding on the Tiger 800 or the Norton

  6. #6
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Quote Originally Posted by Emal View Post

    ...but it is not working if DateReceived is equal to or greater than 10 days ...
    You made no mention of 'equal to or greater than' in your original post, did you, just greater than?

    Using Conditional Formatting, you have to get the order correct for the Operators for 'equal to or greater than,' so it would be

    [ControlName]>= 10

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Posting Permissions

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