how do i use a query in access to work out someones age from thei.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi,
does anyone know how do i use a query in access to work out someones age
from their data of birth?

Thanks
Steve
 
DateDiff("yyyy",[DOB],Date()))-Iif(Format([DOB],"mmdd")>Format(Date(),"mmdd"
),1,0)

Hope that helps.

Rick
 
hi Rick,
is there any way for it to work by getting the DOB from a table?

Thanks
Steve
Rick B said:
DateDiff("yyyy",[DOB],Date()))-Iif(Format([DOB],"mmdd")>Format(Date(),"mmdd"
),1,0)

Hope that helps.

Rick


Steve said:
hi,
does anyone know how do i use a query in access to work out someones age
from their data of birth?

Thanks
Steve
 
Yes, replace [DOB] with your field's name.



Steve said:
hi Rick,
is there any way for it to work by getting the DOB from a table?

Thanks
Steve
Rick B said:
DateDiff("yyyy",[DOB],Date()))-Iif(Format([DOB],"mmdd")>Format(Date(),"mmdd"
),1,0)

Hope that helps.

Rick


Steve said:
hi,
does anyone know how do i use a query in access to work out someones age
from their data of birth?

Thanks
Steve
 
ok, i have tried putting that as criteria, but it says: The expression you
have entered is missing a closing parenthesis, bracket (]), or vertical bar
(|)
any ideas
Thanks
Steve


Rick B said:
Yes, replace [DOB] with your field's name.



Steve said:
hi Rick,
is there any way for it to work by getting the DOB from a table?

Thanks
Steve
Rick B said:
DateDiff("yyyy",[DOB],Date()))-Iif(Format([DOB],"mmdd")>Format(Date(),"mmdd"
),1,0)

Hope that helps.

Rick


hi,
does anyone know how do i use a query in access to work out someones age
from their data of birth?

Thanks
Steve
 
Copy and paste what you have typed and post it.




Steve said:
ok, i have tried putting that as criteria, but it says: The expression you
have entered is missing a closing parenthesis, bracket (]), or vertical bar
(|)
any ideas
Thanks
Steve


Rick B said:
Yes, replace [DOB] with your field's name.



Steve said:
hi Rick,
is there any way for it to work by getting the DOB from a table?

Thanks
Steve
:
DateDiff("yyyy",[DOB],Date()))-Iif(Format([DOB],"mmdd")>Format(Date(),"mmdd"
),1,0)

Hope that helps.

Rick


hi,
does anyone know how do i use a query in access to work out
someones
age
from their data of birth?

Thanks
Steve
 
ok,

DateDiff("yyyy",[DOB],Date()))-Iif(Format([DOB],"mmdd")>Format(Date(),"mmdd"
),1,0)
i put it exactly like this as the field is DOB
Thanks
Steve

Rick B said:
Copy and paste what you have typed and post it.




Steve said:
ok, i have tried putting that as criteria, but it says: The expression you
have entered is missing a closing parenthesis, bracket (]), or vertical bar
(|)
any ideas
Thanks
Steve


Rick B said:
Yes, replace [DOB] with your field's name.



hi Rick,
is there any way for it to work by getting the DOB from a table?

Thanks
Steve
:


DateDiff("yyyy",[DOB],Date()))-Iif(Format([DOB],"mmdd")>Format(Date(),"mmdd"
),1,0)

Hope that helps.

Rick


hi,
does anyone know how do i use a query in access to work out someones
age
from their data of birth?

Thanks
Steve
 
You have your parenthises off. DateDiff("yyyy",[DOB],Date()))- There
are three closing and only one opening. My bad!

Rick B


Steve said:
ok,

DateDiff("yyyy",[DOB],Date()))-Iif(Format([DOB],"mmdd")>Format(Date(),"mmdd"
),1,0)
i put it exactly like this as the field is DOB
Thanks
Steve

Rick B said:
Copy and paste what you have typed and post it.




Steve said:
ok, i have tried putting that as criteria, but it says: The expression you
have entered is missing a closing parenthesis, bracket (]), or
vertical
bar
(|)
any ideas
Thanks
Steve


:

Yes, replace [DOB] with your field's name.



hi Rick,
is there any way for it to work by getting the DOB from a table?

Thanks
Steve
:
DateDiff("yyyy",[DOB],Date()))-Iif(Format([DOB],"mmdd")>Format(Date(),"mmdd"
),1,0)

Hope that helps.

Rick


hi,
does anyone know how do i use a query in access to work out someones
age
from their data of birth?

Thanks
Steve
 
Oops.

Three closing and TWO opening.



Rick B said:
You have your parenthises off. DateDiff("yyyy",[DOB],Date()))- There
are three closing and only one opening. My bad!

Rick B


Steve said:
DateDiff("yyyy",[DOB],Date()))-Iif(Format([DOB],"mmdd")>Format(Date(),"mmdd"
),1,0)
i put it exactly like this as the field is DOB
Thanks
Steve
expression
you
have entered is missing a closing parenthesis, bracket (]), or vertical
bar
(|)
any ideas
Thanks
Steve


:

Yes, replace [DOB] with your field's name.



hi Rick,
is there any way for it to work by getting the DOB from a table?

Thanks
Steve
:
DateDiff("yyyy",[DOB],Date()))-Iif(Format([DOB],"mmdd")>Format(Date(),"mmdd"
 
ok, thanks very much for your help,
so do i just remove the three extra brackets?
Thanks
Steve


Rick B said:
Oops.

Three closing and TWO opening.



Rick B said:
You have your parenthises off. DateDiff("yyyy",[DOB],Date()))- There
are three closing and only one opening. My bad!

Rick B


Steve said:
DateDiff("yyyy",[DOB],Date()))-Iif(Format([DOB],"mmdd")>Format(Date(),"mmdd"
),1,0)
i put it exactly like this as the field is DOB
Thanks
Steve

:

Copy and paste what you have typed and post it.




ok, i have tried putting that as criteria, but it says: The
expression
you
have entered is missing a closing parenthesis, bracket (]), or vertical
bar
(|)
any ideas
Thanks
Steve


:

Yes, replace [DOB] with your field's name.



hi Rick,
is there any way for it to work by getting the DOB from a table?

Thanks
Steve
:
DateDiff("yyyy",[DOB],Date()))-Iif(Format([DOB],"mmdd")>Format(Date(),"mmdd"
),1,0)

Hope that helps.

Rick


hi,
does anyone know how do i use a query in access to work out
someones
age
from their data of birth?

Thanks
Steve
 
Back
Top