Date Fields

J

JB

I'm using the following formula to include Ad date's related to
allocation. If the product has an ad date, the formula shows the date,
but if it doesn't have a date, the filed shows as #Error, is it
possible to make #Error show up as "Blank"?

The struture of the formula is CDate(Left([EADDT],1) & "/" &
Right([EADDT],2)) converts a four filed to a date, (example 0322 would
show as 03/22/2006) and DateSerial were I have to combine three fields
into one date value.

AD Date: IIf([PO_HEAD_EARLIEST_AD_DAY]=0,CDate(Left([EADDT],1) & "/" &
Right([EADDT],2)),DateSerial([PO_HEAD_EARLIEST_AD_YEAR]+2000,[PO_HEAD_EARLIEST_AD_MONTH],[PO_HEAD_EARLIEST_AD_DAY]))
 
G

Guest

AD Date: IIF(([PO_HEAD_EARLIEST_AD_DAY] Is Null) Or
([PO_HEAD_EARLIEST_AD_MONTH] Is Null) Or ([PO_HEAD_EARLIEST_AD_YEAR] Is Null)
Or ([EADDT] Is Null), Null,
IIf([PO_HEAD_EARLIEST_AD_DAY]=0,CDate(Left([EADDT],1) & "/" &
Right([EADDT],2)),DateSerial([PO_HEAD_EARLIEST_AD_YEAR]+2000,[PO_HEAD_EARLIEST_AD_MONTH],[PO_HEAD_EARLIEST_AD_DAY])))

Sorry if this gets chopped up by the line wrapping! The idea is to test all
your fields and return a null ("blank") value if any of them are null (which
would make the calculation impossible and give the #Error) - then if no
nulls, apply your original formula.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top