This topic is locked

Calculating Age from DOB not updating table

3/26/2007 3:14:22 AM
ASPRunnerPro General questions
BeachyLife author

I have a field on my access database called "RAge" and it's defined as a number field. I've got a Before Record Add and Before Record Edit event coded as:
str = "SELECT DateDiff('d,'" & dict("RDOB") & "', Date())/365.35 AS Age FROM Roster"

Set rsTemp = server. CreateObject ( "ADODB.Recordset" )

rsTemp. open str , dbConnection

dict("RAge") = rsTemp("Age")
I get "Record Not Updated" "Type Edit Mismatch when I try to edit the DOB and calculate the age. Why does it not like this event? I'm trying to calculate the age as of today. If I remove the "/365.25" then the calculated age is as of this year.
Thanks in advance for your help

V
Vladimir 3/26/2007

Hi.
debug your SQL Query in the database directly and then use corrected query in your project.

BeachyLife author 3/26/2007

Figured it out. Problem was field definition was not accepting decimal values. Modified table field definition to Precision=4, Scale=1, Decimal Places = 1 and now it updates just fine.