Query to show DOB that are at a certain age by NOW()

jimtimber

Registered User.
Local time
Today, 21:59
Joined
Apr 25, 2014
Messages
118
Hello!

Is there a way of finding out who is turning18 years old in the next 6 months on a set day.

Specifically, I want to minus a date of birth from todays date (DateDiff?) and then for it to show those people who will be turning 18 in the next 6 months.

I've tried a range of Datediffs but I can't seem to get what I need.

Any help would be greatly appreciated!

Jim
 
Jim

The attached should give you what you need. Post back if you can't adopt it to suit your needs.
 

Attachments

Could it be as simple as something along these lines?
Code:
dateadd("Y", 18, DOB) Between date() and dateadd("M", 6, DOB)
 
Apologies, been on my hols. I'm going to give these a try today and see if I can get ti to work. I'll report back soon! Thank you both.

J
 
Jim

The attached should give you what you need. Post back if you can't adopt it to suit your needs.


Hi Rain Lover, I cannot download the attachment, it saves as a php file? It won't save as a mdb file? Any suggestions. I have Access on my PC so not sure why its not recognising it.

J
 
The php page is an issue with many fora on the interwebs and the new Internet explorer.

Try using an older version or some other thing like Chrome or Firefox

Though you shouldnt need his DB, cant you "simply" use what I posted?
 
Hi Liam,

I will try this today/tomorrow and post back.

Thanks

J
 
The php page is an issue with many fora on the interwebs and the new Internet explorer.

Try using an older version or some other thing like Chrome or Firefox

Though you shouldnt need his DB, cant you "simply" use what I posted?

Hi, I modified the code you sent me to this:

"Expr1: DateAdd("y",18,[ChildsDateOfBirth]) Between Date() And DateAdd("m",6,[ChildsDateOfBirth])"

but the records it highlights as true are those born in 2014? Not sure what causes this?

The format for the DOB is dd/mm/yyyy

Thanks,

J

EDIT: I changed the "y" to "yy" and it brought through all those that are 18 and over. I wanted to know who was turning 18 in the next 6 months?
 
Last edited:
Sorry the "Y" should probably be "YYYY"

Yes it should return anyone that was born 18 years ago, between today and 6 months from today.
 
Hi Rain Lover, I cannot download the attachment, it saves as a php file? It won't save as a mdb file? Any suggestions. I have Access on my PC so not sure why its not recognising it.

J

I get the same error.

However if you hit save as and simply rename the file to the original name and extension it should work.

Or use Fire Fox. :banghead:
 
Sorry the "Y" should probably be "YYYY"

Yes it should return anyone that was born 18 years ago, between today and 6 months from today.

I tested this code and could not fault it.
 

Users who are viewing this thread

Back
Top Bottom