Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Evaluating Date Fields 1

Status
Not open for further replies.

sjdbmc

IS-IT--Management
Jan 30, 2004
14
GB
I am attempting to evaluate date fields and enter "----" is blank or the actual date if not.

if year({insurance_details.mtrl_choice_rec}) = 1899 then "----" else
if isnull({insurance_details.mtrl_choice_rec}) then "----" else
if {insurance_details.mtrl_choice_rec} = Date(0,0,0) then "----" else
if trim(totext({insurance_details.mtrl_choice_rec})) = "" then "----" else
totext({insurance_details.mtrl_choice_rec},"dd/MM/yyyy")

I am using the above to check various blank entries i.e null, "" or 0 however some dates although appearing blank are not getting picked up by the above formulas so the date is being returned as blankand not "----".

 
You have to test for Nulls first, so change you formula slightly to :

if isnull({insurance_details.mtrl_choice_rec}) then "----" else
if year({insurance_details.mtrl_choice_rec}) = 1899 then "----" else
if {insurance_details.mtrl_choice_rec} = Date(0,0,0) then "----" else
if trim(totext({insurance_details.mtrl_choice_rec})) = "" then "----" else
totext({insurance_details.mtrl_choice_rec},"dd/MM/yyyy")

Reebo
UK

Please Note - Due to current economic forcast and budget constraints, the light at the end of the tunnel has been switched off. Thank you for your cooperation.
 
No problem. Thanks for the star.[smile]

Reebo
UK

Please Note - Due to current economic forcast and budget constraints, the light at the end of the tunnel has been switched off. Thank you for your cooperation.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top