October 27, 200322 yr Newbies 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!
October 27, 200322 yr 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.
October 27, 200322 yr 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.
October 27, 200322 yr Author Newbies 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!
October 27, 200322 yr 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.
Create an account or sign in to comment