Jump to content

This topic is 7767 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies
Posted

I have this calc that gives the age of someone as of today:

NumToText(Year(Today) - Year(Student Date of Birth) - If(Today<

Date(Month(Student Date of Birth), Day(Student Date of Birth), Year(Today)),

1, 0)) & " Years, " & NumToText(Mod(Month(Today) - Month(Student Date of

Birth) + 12 - If(Day(Today) < Day(Student Date of Birth), 1, 0), 12)) & "

Months, " & NumToText(Day(Today) - Day(Student Date of Birth) +

If(Day(Today) >= Day(Student Date of Birth), 0, If(Day(Today-Day(Today)) <

Day(Student Date of Birth), Day(Student Date of Birth), Day(Today-

Day(Today))))) & " Days"

I changed it to give the person's age as of 8/15/2003:

NumToText(Year(Date( 8, 15, 2003 )) - Year(Student Date of Birth) - If(Date( 8, 15, 2003 )<

Date(Month(Student Date of Birth), Day(Student Date of Birth), Year(Date( 8, 15, 2003 ))),

1, 0)) & " Years, " & NumToText(Mod(Month(Date( 8, 15, 2003 )) - Month(Student Date of

Birth) + 12 - If(Day(Date( 8, 15, 2003 )) < Day(Student Date of Birth), 1, 0), 12)) & "

Months, " & NumToText(Day(Date( 8, 15, 2003 )) - Day(Student Date of Birth) +

If(Day(Date( 8, 15, 2003 )) >= Day(Student Date of Birth), 0, If(Day(Date( 8, 15, 2003 )-Day(Date( 8, 15, 2003 ))) <

Day(Student Date of Birth), Day(Student Date of Birth), Day(Date( 8, 15, 2003 )-

Day(Date( 8, 15, 2003 )))))) & " Days"

Now, I'm getting the error: Too many separators.

Am I correct in replacing the "Today" keyword with Date(8,15,2003) to get the result I'm looking for? Why too many separators? Any hints appreciated! I'm a beginner!

Thanks!

Posted

Yes you can replace Today with Date(8, 15, 2003), but somewhere along the line you must have made a typo. Too many separators means an extra comma, or a misplaced closing parenthesis.

Posted

I received no errors pasting your calc into a field definition. However, I would change Year(Date( 8, 15, 2003 )) to 2003, Month(Date( 8, 15, 2003 )) to 8, and Day(Date( 8, 15, 2003 )) to 15. Also, you can shrink your If(Date( 8, 15, 2003 ) < Date(Month(Student Date of Birth), Day(Student Date of Birth), Year(Date( 8, 15, 2003 ))), 1, 0) to Date( 8, 15, 2003 ) < Date(Month(Student Date of Birth), Day(Student Date of Birth), 2003 ), and similarly with your other boolean If statements.

  • Newbies
Posted

Thanks everybody...I realized my error was being reported in the middle of the calc...I had pasted the calculation from notepad into fm and somehow a line break got stuck in the middle! tongue.gif

Posted

Replace the TODAY function with Status (CurrentDate). The TODAY function only recalculates when the database is opened, so if it's hosted it'll never recalculate.

This topic is 7767 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.