Welcome1.gif (9491 bytes)

Here are the three answers to the riddle:

Uncle Charlie was born April 8, 1946

The PIN is 4629

The trouble dates are April 1 through April 7

Here's Leonard's program again:

Charlies Birth Date =
@Str(@Year(Nada - ((Charlies Age + 2) * 365.25)))
+ "/" + @Str(@Month(Nada)) + "/"

+ @Str(@Right(Nada,1) + 7);

It =
@Mid(Charlies Birth Date, 3, 2)
+ @Str(@Mid(Charlies Birth Date, 3, 1) - 2)
+ @Str(@Right(Charlies Birth Date, 1) + 1)

When Leonard goes to the cash machine on March 28, 1998, Nada will be the date of the next April Fool's Day, or April 1, 1998, which Q&A recognizes as 1998/04/01.

Adding 2 to uncle Charlie's age (50 + 2), multiplying that by 365.25, then subtracting  the result from the Nada year (1998) yields 1946, uncle Charlie's birth year.

All that's left is to add the Nada month (4), then the Nada  day of the month (1) plus 7 to uncle Charlie's birth year to get the birth date (April 8, 1946, or 1946/04/08 to Q&A).

Date arithmetic is then used take that birth date apart in order to calculate the PIN number of 4629.

But Leonard will run into trouble if he goes for cash (and forgets his PIN) between April 1 and April 7 because the next April Fool's day will then be in the following year and uncle Charlie is still 50 until April 8.

About the functions:

@Str()
pronounced "at string," converts whatever is inside the parenthesis to a text value. This function is commonly used to concatenate (string together) numbers that Q&A would otherwise sum.

@Year(x)
returns the four-digit year of the date x, which can be a text value or field reference.

@Month(x)
returns the month number of date x. X can be a field reference.

@Right(x,y)
Returns the rightmost y characters of the value in field x.

@Mid(x,y,z)
looks at the value in field x, and returns z number of characters starting at position y.

Comments? Looking for something? Write us at inbox@quickanswer.com
Want to submit an article to The Quick Answer? Write to office@quickanswer.com
Phone -  800-780-5474 or 949-722-9127 / Fax - 949-722-9127
Marble Publications, 1927A Harbor Blvd., Costa Mesa, California 92627
Last modified: December 11, 2006