S
stainless
Access 2003
I have a table with fields and columns as follows:
DIED DEATH DATE
------- ---------------------
1926(31.10.) null
null 1 Aug 1871
1857(1.4.) 1 Apr 1857
no details null
null null
1857(1.4.) *
I need to create a formatted DAY, MONTH and YEAR column for each with
the following rules:
if DIED starts with a year
DAY = day in DIED date
MONTH = month (3 alpha) in DIED date
YEAR = year in DIED date
else
if DEATH DATE is null
DAY = ""
MONTH = ""
YEAR = ""
else
IF DEATH DATE is *
DAY = ""
MONTH = ""
YEAR = ""
else
DAY = day in DEATH DATE
MONTH = month (3 alpha) in DEATH DATE
YEAR = year in DEATH DATE
Thus, I would want the following results:
DIED DEATH DATE DAY MONTH YEAR
------- --------------------- ------
----------- ---------
1926(31.10.) null 31 Oct
1926
null 1 Aug 1871 1 Aug
1871
1857(1.4.) 1 Apr 1857 1 Apr
1857
no details null
null null
1857(1.3.) * 1
Mar 1857
null *
I tried the following (probably overcomplex) IIF statement for the DAY
value:
IIf(Isnumeric(Left(DIED,4))=True,DAY(replace(replace(replace(right
(DIED,Len(DIED)-5),".)",""),")",""),".","/") & "/" & Left(DIED,4)),IIf
([DEATH DATE]='*',"",IIf([DEATH DATE] Is Null,"",DAY([DEATH DATE]))))
The first part simply reformats the DIED field into dd/mm/yyyy format.
It all worked fine for values in DIED and DEATH DATE but produced an
error when both were null
The reason I find it strange is that when I replaced the DAY([DEATH
DATE]) part with just a constant for debugging ("X"), the DAY field
was empty and this is really conusing as it has stopped the error but
not output the X character.
Any help welcome
Cheers
Mark
I have a table with fields and columns as follows:
DIED DEATH DATE
------- ---------------------
1926(31.10.) null
null 1 Aug 1871
1857(1.4.) 1 Apr 1857
no details null
null null
1857(1.4.) *
I need to create a formatted DAY, MONTH and YEAR column for each with
the following rules:
if DIED starts with a year
DAY = day in DIED date
MONTH = month (3 alpha) in DIED date
YEAR = year in DIED date
else
if DEATH DATE is null
DAY = ""
MONTH = ""
YEAR = ""
else
IF DEATH DATE is *
DAY = ""
MONTH = ""
YEAR = ""
else
DAY = day in DEATH DATE
MONTH = month (3 alpha) in DEATH DATE
YEAR = year in DEATH DATE
Thus, I would want the following results:
DIED DEATH DATE DAY MONTH YEAR
------- --------------------- ------
----------- ---------
1926(31.10.) null 31 Oct
1926
null 1 Aug 1871 1 Aug
1871
1857(1.4.) 1 Apr 1857 1 Apr
1857
no details null
null null
1857(1.3.) * 1
Mar 1857
null *
I tried the following (probably overcomplex) IIF statement for the DAY
value:
IIf(Isnumeric(Left(DIED,4))=True,DAY(replace(replace(replace(right
(DIED,Len(DIED)-5),".)",""),")",""),".","/") & "/" & Left(DIED,4)),IIf
([DEATH DATE]='*',"",IIf([DEATH DATE] Is Null,"",DAY([DEATH DATE]))))
The first part simply reformats the DIED field into dd/mm/yyyy format.
It all worked fine for values in DIED and DEATH DATE but produced an
error when both were null
The reason I find it strange is that when I replaced the DAY([DEATH
DATE]) part with just a constant for debugging ("X"), the DAY field
was empty and this is really conusing as it has stopped the error but
not output the X character.
Any help welcome
Cheers
Mark