-
I have the following function: Function Age(DOB, Optional vDate). I want to know if it's possible to call this function in a recordset? For example: DB.OpenRecordset("SELECT Player_No, Player_Name, age(Player_DOB) as PlayerAge FROM Player").
Of course this won't work. Is there any way of doing this? I only want the player's age calculated from his DOB.
-
you can only call functions that have been predefined in the database like SUM, AVG etc. You can use DateDiff function which is supported by almost all databases, to calculate the difference between Now (in Acccess), SysData (in Oracle) and DOB to calculate the age.
So your SQL stmt (in Access will look like):
SELECT Player_No, Player_Name, DateDiff("y",Now,Player_DOB) as PlayerAge FROM Player