Functions....multiple reports

J

jake

my database has 4 reports that I need to calculate the age of a person.
I now use:
Public Function Age()
If Month([DeathDate]) < Month([Birthdate]) Or _
(Month([DeathDate]) = Month([Birthdate]) And Day([DeathDate]) <
Day([Birthdate])) Then
Age = Year([DeathDate]) - Year([Birthdate]) - 1
Else
Age = Year([DeathDate]) - Year([Birthdate])
End If
End Function

in each report. My qestion, should i use the above code in each report
or is there a more effecient way?

Thanks,
Jake
 
D

Douglas J. Steele

Create a function in a module, and you'll be able to call it from all of
your reports.
 
J

jake

I keep getting an error when I do this.... do I have to declare the
varibles? and if so - as what? Please forgive me, I 'm just learning
this aspect of access

Thanks, Jake
 

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