Two questions

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?
 
G

Guest

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

Jeff Boyce

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

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
G

Guest

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
 
J

Jeff Boyce

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?
 

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

Similar Threads

Tables 2
Calculating age problem 8
how to calculate someones age 3
Limits of IIF? 1
Display Age on Form 3
Form creation problems 1
reference field in a table from a form 4
Age from Date Function 5

Top