Age fiels automaticaly

Hy

I created 2 new fields in customer table (18). Birth date and Age. I would like that the age field should be filled automatically after validate the Birth date field. what Nav function can i use?

Hi,

This will only stamp the age as at the time of validate but if that is what you want:

in the ONVALIDATE

Age := DATE2DMY( WORKDATE , 3) - DATE2DMY( “Birth Date”, 3 ) ;

Hy Dave

DATE2DMY( WORKDATE , 3) - DATE2DMY( “Birth Date”, 3 ) returns one integer, and my Age fiels is a code. how can I change it? I have already records in my table, and change the field type at this moment is not a good option.

Is there any way to convert DATE2DMY( WORKDATE , 3) - DATE2DMY( “Birth Date”, 3 ) to a code?

Hi,

Just use the FORMAT command

e.g.

Age := FORMAT(DATE2DMY( WORKDATE , 3) - DATE2DMY( “Birth Date”, 3 ) );

Thanks Dave