Date reporting

  • Thread starter Thread starter Gene Hora
  • Start date Start date
G

Gene Hora

Using Access 97, each year on August 31, a report must generate a list of
certain persons under age 18. The DOBs are shown in another field. Have no
programming experience and in perusing various newsgroups couldn't come up
with any help. Also the date functions in the Access Help section gave
little insight.

Thanks,

Gene Hora
 
Create a column in your reports record source query
Age:DateDiff("yyyy", [DOB], Now())+ Int( Format(now(), "mmdd") <
Format( [DOB], "mmdd") )
set the criteria to
<18
 
In this case, mightn't it be more efficient to figure out what date their
birthdays have to be after, using DateSerial(Year(Date())-18, 8, 31), and
just compare their DOB to that? You'd only have one function calculation
then.

--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)



Duane Hookom said:
Create a column in your reports record source query
Age:DateDiff("yyyy", [DOB], Now())+ Int( Format(now(), "mmdd") <
Format( [DOB], "mmdd") )
set the criteria to
<18
--
Duane Hookom
MS Access MVP


Gene Hora said:
Using Access 97, each year on August 31, a report must generate a list of
certain persons under age 18. The DOBs are shown in another field. Have no
programming experience and in perusing various newsgroups couldn't come up
with any help. Also the date functions in the Access Help section gave
little insight.

Thanks,

Gene Hora
 
Thanks to both of you. Either of the suggested solutions work just fine.
Mr. Steele's proposal probably better suits our needs. Really appreciate
the quick, expert help -- I certainly couldn't have done this myself.

Douglas J. Steele said:
In this case, mightn't it be more efficient to figure out what date their
birthdays have to be after, using DateSerial(Year(Date())-18, 8, 31), and
just compare their DOB to that? You'd only have one function calculation
then.

--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)



Duane Hookom said:
Create a column in your reports record source query
Age:DateDiff("yyyy", [DOB], Now())+ Int( Format(now(), "mmdd") <
Format( [DOB], "mmdd") )
set the criteria to
<18
--
Duane Hookom
MS Access MVP


Gene Hora said:
Using Access 97, each year on August 31, a report must generate a list of
certain persons under age 18. The DOBs are shown in another field.
Have
come
 
A curious thing. I used the "DateSerial(Year(Date())-18, 8, 31)" statement
in a query and on a copy of the database on my machine and obtained a report
exactly as needed. I copied the revised database to our church PC, which
like mine is running WinXP and Access 97 (SR-1). No matter how I try to
troubleshoot it or revamp it, when attempt to open the report, this error
message always pops up:

"Function isn't available in expressions in query expression
'DateSerial(Year(Date())-18,8,31)'." (the outside quotes are mine)

Went back to my PC and the report still executes OK. Is there some VB
module missing from our church PC -- or something else?

Douglas J. Steele said:
In this case, mightn't it be more efficient to figure out what date their
birthdays have to be after, using DateSerial(Year(Date())-18, 8, 31), and
just compare their DOB to that? You'd only have one function calculation
then.

--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)



Duane Hookom said:
Create a column in your reports record source query
Age:DateDiff("yyyy", [DOB], Now())+ Int( Format(now(), "mmdd") <
Format( [DOB], "mmdd") )
set the criteria to
<18
--
Duane Hookom
MS Access MVP


Gene Hora said:
Using Access 97, each year on August 31, a report must generate a list of
certain persons under age 18. The DOBs are shown in another field.
Have
come
 
Back
Top