August 11, 200421 yr I am attempting to create a formula to automatically obtain a person's age from their date of birth. I have three fields: Date:(today's date), D.O.B., and Age:. I need the age to be automatically calculated after the user types in the patient's date of birth (D.O.B.). I know this can be done, I am just not sure of how to go about setting it up. Can someone out there help? I have attached a copy of my db if anyone cares to take a look. Dave EKGSTRESSTEST-6Copy.zip
August 11, 200421 yr Author Sorry about the empty zip file. I thought it contained the db. I'll give it another try. Thanks for letting me know. Dave
August 11, 200421 yr Author Here's the db that didn't go the first time. (I hope!). EKGSTRESSTEST-6Copy.zip
August 12, 200421 yr Dont need the db. Here is what you are looking for. GetAsText(Year(Get(CurrentDate)) - Year(DOB) - Case(Get(CurrentDate)< Date(Month(DOB); Day(DOB); Year(Get(CurrentDate))); 1)) Result is an unstored number.
August 12, 200421 yr I've been looking for this calc also and ty for publishing it but it doesn't make me older after this year's birthday. eg DOB is 9/30/1967 it caculates 36 which is correct. But if i change the DOB to 11/30/1967 it still calculateds 36. ??
August 12, 200421 yr it doesn't make me older after this year's birthday. eg DOB is 9/30/1967 it caculates 36 which is correct. But if i change the DOB to 11/30/1967 it still calculateds 36. ?? What's wrong in staying 36yo another 2 months??? Obviously this calc won't get you older as long as your computer clock doesn't hit the limit. Change [color:"red"]your birthday into today or [color:"red"]your clock into your birthday and you'll see you're getting older (not necessarily wiser) right now... Got it?
August 12, 200421 yr Author I tried the code, but all I get is a ? in the Age: box. Should it be set as text or number (although both settings resulted in the same ?).
August 13, 200421 yr Author If you get a chance, could you take a look at my db from the previous post and see if you can get it to work by adding the formula to the Age: field? I must be doing something wrong, but I just can't seem to figure it out. Dave EKGSTRESSTEST-6Copy.zip
August 13, 200421 yr Author After pulling out what is left of my hair, I finally got the age/dob thing to work. My problem was that I had not set both the date and dob fields as dates. When I did that and added the below formula to the Age: field, everything worked like a charm. Int((Date - DOB) / 365) Thanks to those who tried to help me. Dave
August 13, 200421 yr Int((Date - DOB) / 365) This calc does not give the correct age all year long. Just paste the calc I previously gave you.
August 13, 200421 yr A slight mod: you don't need the GetAsText or Case statement. Year(Get(CurrentDate)) - Year(DOB) - (Get(CurrentDate)< Date(Month(DOB); Day(DOB); Year(Get(CurrentDate))))
August 14, 200421 yr Author I finally figured it out: the simple way to do it is in the Age field, place the formula: (date-dob)/365. Make sure that both the date and dob fields are set as "date" fields and not as NUMBERS -- or anything else!! (this make the whole thing gibberish!!! Also, make sure the Age field is set as a number! Otherwise, you get some very strange calculations.... By the way, it doesn't seem to matter how you format the date and dob fields (either with slashes or dashes) Both seem to work equally well. Thanks to all who offered suggestions..... Dave
August 14, 200421 yr As Logixx has already stated, your calculation will not give you the correct age all the time. Dividing by 365 is not a proper way to determine it. You should use the calc above.
August 15, 200421 yr As Logixx has already stated, your calculation will not give you the correct age all the time. Dividing by 365 is not a proper way to determine it. You should use the calc above. I agree... the previously mentioned solution will work well - I've also found this to be a useful Auto Enter Calculation for the Date of Birth. This corrects the tendancy for users to enter a two digit year, it takes it to the previous century if the two digit year would result in a date beyond todays date. DOB = If(DOB>Get(CurrentDate); DOB-(36525) ; DOB) And then... Age = If(IsEmpty(DOB); Age; Year(Get(CurrentDate)) - Year( DOB) - (Get(CurrentDate) < Date(Month( DOB); Day( DOB); Year(Get(CurrentDate)))))
August 16, 200421 yr I'm looking for a calc that will give me the difference between the a timestamp field in two related records (it's a billable time db). I just need to know how much time to bill using the info. The records are related by a job# field. I'm working in FM7. I've tried using a summary field in the related table, and no luck with it so far. I know I'm missing something simple, but damned if I know what it is! : Any help is truly appreciated! TonyO
Create an account or sign in to comment