Missing Calculated Age Values

A

AGOKP4

Hello,

I used DateDiff("yyyy",[Birth date],Date()) to calculate age from birth date
in a query. However, the records that don't have any birth dates are missing
from the results.

Is there any way to get those missing records? I need to keep track of the
data in spite of missing birthd ates


Thank you
 
J

Jeff Boyce

One approach might be to embed that DateDiff() calculation within an Nz()
test expression, showing something like "No DOB" when the [BirthDate] is
null.

Remember that a field may be Null, or may hold a zero-length string. To the
human eye, they both look the same. To Access, however... !

Regards

Jeff Boyce
Microsoft Access MVP
 
A

AGOKP4

Hello Jeff,

Thank you for your reply, how do I embed that? Can you give me an example
of the expression.

THANKS!!

Jeff Boyce said:
One approach might be to embed that DateDiff() calculation within an Nz()
test expression, showing something like "No DOB" when the [BirthDate] is
null.

Remember that a field may be Null, or may hold a zero-length string. To the
human eye, they both look the same. To Access, however... !

Regards

Jeff Boyce
Microsoft Access MVP


AGOKP4 said:
Hello,

I used DateDiff("yyyy",[Birth date],Date()) to calculate age from birth
date
in a query. However, the records that don't have any birth dates are
missing
from the results.

Is there any way to get those missing records? I need to keep track of
the
data in spite of missing birthd ates


Thank you
 
J

Jeff Boyce

In a query, something like (untested):

IIF(Nz([BirthDate],"")="","No DOB", DateDiff("yyyy",[Birth
date],Date()))

Regards

Jeff Boyce
Microsoft Access MVP



AGOKP4 said:
Hello Jeff,

Thank you for your reply, how do I embed that? Can you give me an example
of the expression.

THANKS!!

Jeff Boyce said:
One approach might be to embed that DateDiff() calculation within an Nz()
test expression, showing something like "No DOB" when the [BirthDate] is
null.

Remember that a field may be Null, or may hold a zero-length string. To
the
human eye, they both look the same. To Access, however... !

Regards

Jeff Boyce
Microsoft Access MVP


AGOKP4 said:
Hello,

I used DateDiff("yyyy",[Birth date],Date()) to calculate age from birth
date
in a query. However, the records that don't have any birth dates are
missing
from the results.

Is there any way to get those missing records? I need to keep track of
the
data in spite of missing birthd ates


Thank you
 
A

AGOKP4

Hello Jeff,

I tried the expression you sent but for some reason it didn't work, i was
just meant to copy paste it right?

Regards,
AGOKP4

Jeff Boyce said:
In a query, something like (untested):

IIF(Nz([BirthDate],"")="","No DOB", DateDiff("yyyy",[Birth
date],Date()))

Regards

Jeff Boyce
Microsoft Access MVP



AGOKP4 said:
Hello Jeff,

Thank you for your reply, how do I embed that? Can you give me an example
of the expression.

THANKS!!

Jeff Boyce said:
One approach might be to embed that DateDiff() calculation within an Nz()
test expression, showing something like "No DOB" when the [BirthDate] is
null.

Remember that a field may be Null, or may hold a zero-length string. To
the
human eye, they both look the same. To Access, however... !

Regards

Jeff Boyce
Microsoft Access MVP


Hello,

I used DateDiff("yyyy",[Birth date],Date()) to calculate age from birth
date
in a query. However, the records that don't have any birth dates are
missing
from the results.

Is there any way to get those missing records? I need to keep track of
the
data in spite of missing birthd ates


Thank you
 
J

Jeff Boyce

No, that comment in parentheses (untested), means I haven't tested it.
You'll need to try it and adjust as needed.

Out of curiosity, WHERE did you try it?

Regards

Jeff Boyce
Microsoft Access MVP


AGOKP4 said:
Hello Jeff,

I tried the expression you sent but for some reason it didn't work, i was
just meant to copy paste it right?

Regards,
AGOKP4

Jeff Boyce said:
In a query, something like (untested):

IIF(Nz([BirthDate],"")="","No DOB", DateDiff("yyyy",[Birth
date],Date()))

Regards

Jeff Boyce
Microsoft Access MVP



AGOKP4 said:
Hello Jeff,

Thank you for your reply, how do I embed that? Can you give me an
example
of the expression.

THANKS!!

:

One approach might be to embed that DateDiff() calculation within an
Nz()
test expression, showing something like "No DOB" when the [BirthDate]
is
null.

Remember that a field may be Null, or may hold a zero-length string.
To
the
human eye, they both look the same. To Access, however... !

Regards

Jeff Boyce
Microsoft Access MVP


Hello,

I used DateDiff("yyyy",[Birth date],Date()) to calculate age from
birth
date
in a query. However, the records that don't have any birth dates
are
missing
from the results.

Is there any way to get those missing records? I need to keep track
of
the
data in spite of missing birthd ates


Thank you
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top