Allow editing of a calculated field

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

Guest

Hi

I have a Form which has a Birthdate field which users enter the birthdate
into. There is a Text Box next to it which looks at the Birthdate and
calculates the person's age.

However, I need the users to be able to *manually enter* the Age of someone
in the Age field, because sometimes we do not know the exact Birthdate of
people but only know their age.

I am thinking that some sort of query might be in order but am stumped as to
how to do it!!

Any suggestions from you lovely people out there??
 
It sounds like you are using the control source property to auto calc the
persons age?

Don't

use one of the events on the birthdate textbox use Before_Update event put
your calculation for the age in there, because the control source not the
calculation, 2 things happen you can bind the textbox to a table field and
secondly you can overwrite the figure.
 
Hmm.

Where you need to cope with some actual birtdates and some where you know
only the age, you might consider recording the age in the birthdate field
(e.g. 1/1/1990 for a 15 y.o.), with a yes/no field to indicate
BirthDateIsGuess. This has the advantage that the age does not gradually
become more and more inaccurate as the years go by, but you still know which
are the true ages.

For the interface, you could have a text box that calculates the age, and an
unbound text box behind it. In the GotFocus event of the Age text box, copy
its Value to the unbound box, and SetFocus to that. Then in the AfterUpdate
event of the unbound box, assign a value to the BirthDate field, and set
BirthDateIsGuess to True.

That simple arrangement behaves as if the user is entering the age into the
box that is actually a calculated control, and it even works correctly in a
continuous form/datasheet.
 
Alex, I tried to do what you suggested but think I have missed a trick.
Could you please describe in bullet points exactly what I need to do, as I am
a little lost?

Thanks
 
Hi, Have you figured this out? I have the same question and would really
appreciate any help. Thanks -
 
Back
Top