Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Age on Unbound text box Not working 1

Status
Not open for further replies.

Nicos67

Programmer
Apr 28, 2004
52
0
0
GB
Hello All,

I have set up a text box to work out the age of client from their date of birth (Pat_DOB) which is completed in previous text box.

I ahve inserted the following expression at Control Source of Unbound Age text box

=(Int((Date()-[Pat_DOB])/365))

However when age text box is diSplAyed in form it shows the following:

#Name?

Please Help

Nicos
 
You must have a typo in the actual formula. It looks fine here.(Given that in some cases it will give an age that is one year out)
 
Do this rather:

On the 'On change' event of the Pat_DOB textbox, put the following code. NOte that this assumes that the Age of client textbox is called txtCurrentAge.

txtCurrentAge==(Int((Date()-[Pat_DOB])/365))

That way, everytime you change the DOB, the age will update automatically.

Hope this helps


 
Hi Nicos,

Make sure your DOB text box had a format of Short Date as your code works fine on my machine.

Hope that helps

Sim

----------------------------------------
I was once asked if I was ignorant or just apathetic. I said, "I don't know, and I don't care."
----------------------------------------
 
Thanks

Lupins & JonoB

Much appreciated

Nicos
 
lupis146 said:
... .(Given that in some cases it will give an age that is one year out) ...

give that 'some' ~ 50%




MichaelRed
mlred@verizon.net

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top