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

jimtimber

Registered User.
Local time
Today, 05:20
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
 

RainLover

VIP From a land downunder
Local time
Today, 14:20
Joined
Jan 5, 2009
Messages
5,041
Jim

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

Attachments

  • Age.mdb
    188 KB · Views: 83

namliam

The Mailman - AWF VIP
Local time
Today, 06:20
Joined
Aug 11, 2003
Messages
11,695
Could it be as simple as something along these lines?
Code:
dateadd("Y", 18, DOB) Between date() and dateadd("M", 6, DOB)
 

jimtimber

Registered User.
Local time
Today, 05:20
Joined
Apr 25, 2014
Messages
118
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
 

jimtimber

Registered User.
Local time
Today, 05:20
Joined
Apr 25, 2014
Messages
118
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
 

namliam

The Mailman - AWF VIP
Local time
Today, 06:20
Joined
Aug 11, 2003
Messages
11,695
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?
 

jimtimber

Registered User.
Local time
Today, 05:20
Joined
Apr 25, 2014
Messages
118
Hi Liam,

I will try this today/tomorrow and post back.

Thanks

J
 

jimtimber

Registered User.
Local time
Today, 05:20
Joined
Apr 25, 2014
Messages
118
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:

namliam

The Mailman - AWF VIP
Local time
Today, 06:20
Joined
Aug 11, 2003
Messages
11,695
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.
 

RainLover

VIP From a land downunder
Local time
Today, 14:20
Joined
Jan 5, 2009
Messages
5,041
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:
 

RainLover

VIP From a land downunder
Local time
Today, 14:20
Joined
Jan 5, 2009
Messages
5,041
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

Top Bottom