K
kdbarrett
I'm having problem with the Make Table Query below. I have a table
with month, day and year stored as three separate, 2-character string
fields (I did NOT design this database). I need to write queries that
compare dates so I came up with this query convert these string fields
into usable dates. It works fine EXCEPT the year fields with a value
of 29 and lower are converted to 2029 instead of 1929. Is there a
setting somewhere to change this? Do I need to force a "19" into the
year field?
Being overly paranoid about posting client data structure, I've
replaced table names with Table1 and Table2, the location of the
database with <database>, removed keywords in the fieldnames and added
bogus selection criteria.
SELECT Table1.Number, Table2.Code, IIF(Table2.1Name<>"",
cdate(Table2.1MM & "/" & Table2.1DD & "/" & Table2.YY), date()) AS
1DOB, IIF(Table2.2Name<>"", cdate(Table2.2MM & "/" & Table2.2DD & "/" &
Table2.2YY), date()) AS 2DOB, IIF(Table2.3Name<>"", cdate(Table2.3MM &
"/" & Table2.3DD & "/" & Table2.3YY), date()) AS 3DOB,
IIF(Table2.4Name<>"", cdate(Table2.4MM & "/" & Table2.4DD & "/" &
Table2.4YY), date()) AS 4DOB INTO Tbl_MadeTable IN '<database>.mdb'
FROM Table1 INNER JOIN Table2 ON Table1.Number = Table2.Number
WHERE (((Table1.Code)="AA") AND ((Table2.Code)<>"-"));
Thanks for your help
Kevin Barrett
with month, day and year stored as three separate, 2-character string
fields (I did NOT design this database). I need to write queries that
compare dates so I came up with this query convert these string fields
into usable dates. It works fine EXCEPT the year fields with a value
of 29 and lower are converted to 2029 instead of 1929. Is there a
setting somewhere to change this? Do I need to force a "19" into the
year field?
Being overly paranoid about posting client data structure, I've
replaced table names with Table1 and Table2, the location of the
database with <database>, removed keywords in the fieldnames and added
bogus selection criteria.
SELECT Table1.Number, Table2.Code, IIF(Table2.1Name<>"",
cdate(Table2.1MM & "/" & Table2.1DD & "/" & Table2.YY), date()) AS
1DOB, IIF(Table2.2Name<>"", cdate(Table2.2MM & "/" & Table2.2DD & "/" &
Table2.2YY), date()) AS 2DOB, IIF(Table2.3Name<>"", cdate(Table2.3MM &
"/" & Table2.3DD & "/" & Table2.3YY), date()) AS 3DOB,
IIF(Table2.4Name<>"", cdate(Table2.4MM & "/" & Table2.4DD & "/" &
Table2.4YY), date()) AS 4DOB INTO Tbl_MadeTable IN '<database>.mdb'
FROM Table1 INNER JOIN Table2 ON Table1.Number = Table2.Number
WHERE (((Table1.Code)="AA") AND ((Table2.Code)<>"-"));
Thanks for your help
Kevin Barrett