Two questions

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I created this module:
Option Compare Database
Option Explicit

Public Function Age2(Birthdate As Date)
Age2 = Int((Date - Birthdate) / 365.25)
End Function

Which worked until just a few moments ago, and then I started getting an
error message.

And

I'm trying to add a new text box to one of my forms (Named "Actors") and in
that text box I want to put their age. I already have a birthdate box on the
form. But I want to add their age, using the function that i created. How do
I do that?
 
I got the function to work again, so nevermind on that. But I still can't
figure out the form
 
In the control's Control Source property, put something like:
=Age2([YourDOBFieldName])
(your syntax may vary).

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
If I wanted to add the age to the table, how do I go about doing that?
I added another colume for age and when I went into design view I didn't
know where to put =Age2([YourDOBFieldName]), so I put it into "format" (data
type is text), but that didn't work. Is it possible to add the age?

Jeff Boyce said:
In the control's Control Source property, put something like:
=Age2([YourDOBFieldName])
(your syntax may vary).

Regards

Jeff Boyce
Microsoft Office/Access MVP

KISSnACDC said:
I got the function to work again, so nevermind on that. But I still can't
figure out the form
 
Already responded to elsewhere...

Short answer -- DON'T!

Longer answer -- don't store calculated ages in the table, calculated them
'as-needed'.

Regards

Jeff Boyce
Microsoft Office/Access MVP


KISSnACDC said:
If I wanted to add the age to the table, how do I go about doing that?
I added another colume for age and when I went into design view I didn't
know where to put =Age2([YourDOBFieldName]), so I put it into "format"
(data
type is text), but that didn't work. Is it possible to add the age?

Jeff Boyce said:
In the control's Control Source property, put something like:
=Age2([YourDOBFieldName])
(your syntax may vary).

Regards

Jeff Boyce
Microsoft Office/Access MVP

KISSnACDC said:
I got the function to work again, so nevermind on that. But I still
can't
figure out the form

:

I created this module:
Option Compare Database
Option Explicit

Public Function Age2(Birthdate As Date)
Age2 = Int((Date - Birthdate) / 365.25)
End Function

Which worked until just a few moments ago, and then I started getting
an
error message.

And

I'm trying to add a new text box to one of my forms (Named "Actors")
and
in
that text box I want to put their age. I already have a birthdate box
on
the
form. But I want to add their age, using the function that i created.
How
do
I do that?
 
Back
Top