DateSerial Function - Avoid #Error?
in one of the databases i'm rebuilding, i'm also creating (from scratch) some queries and reports that need to exist, but never did in the old version of the database. one of these is a query that calculates a resident's next birthday date based on their actual birthdate. here's where the problem lies...
)
i would like to edit this statement so that if, by chance, the field DOB_1 is empty/null, it will ignore that record and move on.. so that i don't end up with a ton of #Error values down the "Birthday_1" column.
i tried experimenting with NZ(), but couldn't quite figure out how to get it to work. any ideas?
in one of the databases i'm rebuilding, i'm also creating (from scratch) some queries and reports that need to exist, but never did in the old version of the database. one of these is a query that calculates a resident's next birthday date based on their actual birthdate. here's where the problem lies...
(i'm aware that this may not be the best or most efficiently written statement. i'm still pretty new to SQL ViewDateSerial(Year(Date())+IIf(Month(Resident_Info.DOB_1)*100+Day(Resident_Info.DOB_1)<=Month(Date())*100+Day(Date()),1,0),Month(Resident_Info.DOB_1),Day(Resident_Info.DOB_1)) AS Birthday_1
i would like to edit this statement so that if, by chance, the field DOB_1 is empty/null, it will ignore that record and move on.. so that i don't end up with a ton of #Error values down the "Birthday_1" column.
i tried experimenting with NZ(), but couldn't quite figure out how to get it to work. any ideas?
Last edited: