Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Future Dates 2

Status
Not open for further replies.

scon165

Technical User
Dec 27, 2001
7
US
I have a patient list that needs to pull those patients that will turn 65 within whatever time frame the end user wants to specify. How do I write the formula to find those patients in the record selection?
 
You will need to name your two parameters StartDate and EndDate, and update {Table.BIRTHDATE} with the correct Table and Field name.

Record Selection Formula

{Table.BIRTHDATE} >= DateTime ((Year ({?StartDate})-65),Month ({?StartDate}) ,Day ({?StartDate})) and
{Table.BIRTHDATE} <= DateTime ((Year ({?EndDate})-65),Month ({?EndDate}) ,Day ({?EndDate}))
 
I think that you need to ammend that to:

Record Selection Formula

{Table.BIRTHDATE} >= Date((Year ({?StartDate})-65),Month ({?StartDate}) ,Day ({?StartDate})) and
{Table.BIRTHDATE} <= Date ((Year ({?EndDate})-65),Month ({?EndDate}) ,Day ({?EndDate}))

If the table.birthdate is a datetime field, then you might want to use a datetime to assure SQL pass through:

{Table.BIRTHDATE} >= Datetime((Year ({?StartDate})-65),Month ({?StartDate}) ,Day ({?StartDate}),0,0,0) and
{Table.BIRTHDATE} <= Datetime ((Year ({?EndDate})-65),Month ({?EndDate}) ,Day ({?EndDate}),23,59,59)

-k
 
Thanks to both of you. This worked great.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top