Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Access (https://www.askmehelpdesk.com/forumdisplay.php?f=441)
-   -   How to highlight, update and replace in same table (https://www.askmehelpdesk.com/showthread.php?t=180461)

  • Feb 4, 2008, 09:51 PM
    susan100
    How to highlight, update and replace in same table
    I would like to highlight a field in a table or form by changing background color when someone turns 18 years old. THis alerts me to delete them from the database of over 5000 names. I have a [DOB] date of birth field currently. Also, when I enter a new record in the database and put in the birthdate how can I if I add a new column named age(which shows their age) automatically update to show their age? Last question how do I delete a hyphen out of a number field and replace with a space for about 2000 of the 5000 records?
  • Feb 29, 2008, 07:36 AM
    ScottGem
    Look at conditional formatting.

    You should NOT be storing age. As a general rule we do not store calculated values. You can use the following expression to calculate the age of a person:

    DateDiff("yyyy", [Bdate], Now())+Int( Format(now(), "mmdd") < Format( [Bdate], "mmdd") )

    You can use that (adding >=18) as the Condition for control you want to change the background color for.

    On another note, you would do this on a form, not a table. Interaction with data should only be done through forms. And you don't have fields on a form, you have controls that may or may not be bound to fields in a table. This is a subtle but important distinction.


    Finally, you would use the Replace feature under the Edit menu.

  • All times are GMT -7. The time now is 10:25 AM.