Results 1 to 8 of 8
  1. #1
    Lounger
    Join Date
    Oct 2008
    Location
    Southampton, Hampshire, United Kingdom
    Posts
    39
    Thanks
    7
    Thanked 0 Times in 0 Posts
    Hi to you all,

    I have a field for vehicle licence expiry dates, I would like to be pre warned 30 days or so BEFORE the persons driving licence expires by making the field background turn red...

    is this possible..

    kind regards

    Steve Gulliver
    Southampton UK

  2. #2
    5 Star Lounger
    Join Date
    Apr 2003
    Location
    Hampshire, United Kingdom
    Posts
    602
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='hajankel' post='771699' date='22-Apr-2009 10:25']I have a field for vehicle licence expiry dates, I would like to be pre warned 30 days or so BEFORE the persons driving licence expires by making the field background turn red...

    is this possible..[/quote]

    Yes, assuming that we're talking about a form as opposed to looking at the raw table.

    One way to do this is to use Access VBA's OnCurrent event, which will trigger whenever a new record is loaded into the form.


    (air code)
    [codebox]If [LicenceExpiry]-30 <= Date Then
    LicenceExpiry.BackStyle = 1
    LicenceExpiry.BackColor = rgb (255,0,0)
    Else
    LicenceExpiry.BackStyle = 0 ' sets it to transparent. change it to white (or whatever else) if you prefer by chaning the BackColor property instead
    End If[/codebox]

    But probably the easier way is to use conditional formatting. The expression to use is similar to the above: [LicenceExpiry]-30<=Date.
    Waggers
    If at first you do succeed, you&#39;ve probably missed something.

  3. #3
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts
    Conditional Formatting is another situation where the Date function needs its brackets.

    [LicenceExpiry]]<Date()+30
    Regards
    John



  4. #4
    Lounger
    Join Date
    Oct 2008
    Location
    Southampton, Hampshire, United Kingdom
    Posts
    39
    Thanks
    7
    Thanked 0 Times in 0 Posts
    Hi Guys

    thanks very much for your help, I have inserted the routine you suggested, I think it's almost there, however I think I must be doing something slightly wrong? When I put in this command it changes ALL my existing drivers on the database some 400 or so... Wonder if you chaps have any other ideas...


    kind regards

    Steve Gulliver
    Southampton UK

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Do you have a continuous form? A continuous form essentially contains a single set of controls - if you change the background color of a control, it will change in all displayed records.
    Conditional formatting, however, works at the individual record level, so it's more suitable for your purpose.

  6. #6
    5 Star Lounger
    Join Date
    May 2001
    Location
    Patterson Lakes, Melbourne, Victoria, Australia
    Posts
    637
    Thanks
    0
    Thanked 0 Times in 0 Posts
    However, conditional formatting will change only the record effected in a continuous form, which is probably what is wanted.
    Regards,
    Peter

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Thanks for the confirmation.

  8. #8
    Lounger
    Join Date
    Oct 2008
    Location
    Southampton, Hampshire, United Kingdom
    Posts
    39
    Thanks
    7
    Thanked 0 Times in 0 Posts
    Thank you very much indeed gentleman, I have used the formatting option. And it works fine..

    kind regards

    Steve Gulliver
    Southampton UK

Posting Permissions

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