I am trying to run a query that returns individuals born after 1/1/1994. I am working with a legacy database and the birth date is stored as text. I was able to convert the records to date format using CDate. However, when I include a search parameter for people born after 1/1/1994 I get a data type mismatch error. I get the same error when I try to sort the "Reformatted Birth Date" column.
Looking at the code I think the problem is the WHERE clause is using [BirthDate] for the search parameter. That field is still formatted as text. Is there a way to query the calculated column [Reformated BirthDate]created by the query?
Thank you in advance for any help.
Code:
SELECT PatientData.PatientName, PatientData.SocSecNum, PatientData.BirthDate, PatientData.PatIDNum, LinkFormPat.TripSeqNum, CDate(Nz([BirthDate],"11/11/1911")) AS [Reformated BirthDate]
FROM PatientData INNER JOIN LinkFormPat ON PatientData.PatIDNum = LinkFormPat.PatIDNum
WHERE (((CDate(Nz([BirthDate],"11/11/1911")))>=#1/1/1994#));
Looking at the code I think the problem is the WHERE clause is using [BirthDate] for the search parameter. That field is still formatted as text. Is there a way to query the calculated column [Reformated BirthDate]created by the query?
Thank you in advance for any help.