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 MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replace #Error with Standard Message 1

Status
Not open for further replies.

Mike555

Technical User
Feb 21, 2003
1,200
US
I have the following expression in a query:
FirstDayofWeek: [DateAdded]-Format([DateAdded],"w",2)

My problem is that whenever the DateAdded field is blank the message #Error appears. Is it possible for me to modify the expression so that records returning #Error simply just display a null field?

Thanks.

--
Mike

Why make it simple and efficient when it can be complex and wonderful?
 
Hi,

FirstDayofWeek: iif(isnull([DateAdded]), "",[DateAdded]-Format([DateAdded],"w",2))

Not tested, but essentially says:

if Dateadded is null, then result = "", else your formula.

iif works like this:

iif (condition , statement_if_true, statement_if_false)

ATB

Darrylle

Never argue with an idiot, he'll bring you down to his level - then beat you with experience. darrylles@yahoo.co.uk
 
Cheers Darrylle! Worked Perfectly!

--
Mike

Why make it simple and efficient when it can be complex and wonderful?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top