Creating a calculated field using dates in a form

  • Thread starter Thread starter Becajo
  • Start date Start date
B

Becajo

I am trying to use dates from 2 fields in a form (HireDate-DOB) to calculate
age. Then, using the age, I want to display a message if the age is less
than 18. I think I have written a conditional statement correctly, but am
unsure where to place it so that the message displays when the condition is
met.

I am totally new to Access 2007 and VB.
 
You did not say what the content of your 'conditional statement' was and how
you plan on using it.
What has HireDate to do with it? Is it you want to see if their age is
less than 18 on the date of hiring? Then this will check if your dates are
stored in a date field and not in text.

IIF(DateDiff("yyyy", [HireDate], [DOB]) <= 18, "Place your statement
here", "")

Or --
IIF(DateDiff("yyyy", [HireDate], [DOB]) <= 18, "Place your statement
here", "Welcome")
 
Becajo said:
I am trying to use dates from 2 fields in a form (HireDate-DOB) to
calculate
age. Then, using the age, I want to display a message if the age is less
than 18. I think I have written a conditional statement correctly, but am
unsure where to place it so that the message displays when the condition
is
met.

I am totally new to Access 2007 and VB.
 
Back
Top