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

Working with Dates in a report 1

Status
Not open for further replies.

xlbo

MIS
Mar 26, 2002
15,080
0
0
GB
Hello all,
currently working on a report where within any given group, a certain date may or may not exist.

Have taken care of that in the SQL using:

Code:
ISNULL(dbo.ScheduleOfDilapidations.SurveyDate, '') AS SurveyDate

However, in the report itself, as the field is formatted as dd/MM/yyyy, these are being displayed as 01/01/1900. Now, this is not entirely unexpected so I tried putting some IIF statements together to coerce a blank field instead but nothing seems to work....

I have tried amending the format of the field:
=IIF(LEN(Fields.SurveyDate.Value.tostring) < 1 ,"General","dd/MM/yyyy")

and the colour of the field
=IIF(Fields.SurveyDate.Value) < 1 ,"White","Black")

Neither of these approaches seems to work and I cannot figure out if it is because I need to convert the date differently 1st or whether anything in a dd/MM/yyyy format will show as 01/01/1900 if there is no data or even if I should handle it differently in the SQL

Any suggestions would be welcomed

Rgds, Geoff

A file that big? It might be very useful. But now it is gone

Please read FAQ222-2244 before you ask a question
 
Have you tried using the isnothing() function yet?

IIF(isnothing(Fields.SurveyDate.Value) ,"White","Black"))

and

=IIF(isnothing(Fields.SurveyDate.Value),"General","dd/MM/yyyy")

THe first one, for colors, I've used plenty of times, so I know it works. The second one, not so sure about.




Catadmin - MCDBA, MCSA
"If a person is Microsoft Certified, does that mean that Microsoft pays the bills for the funny white jackets that tie in the back???
 
cheers - will try that. I'm a bit of a noob at .NET. I'm pretty experienced at VBA and it all looks kinda similar but there are enough differences to throw me off !!

Thanks again

Rgds, Geoff

Three things are certain. Death, taxes and lost data. DPlank is to blame

Please read FAQ222-2244 before you ask a question
 
Anytime. You've certainly helped me enough in other forums. @=)



Catadmin - MCDBA, MCSA
"If a person is Microsoft Certified, does that mean that Microsoft pays the bills for the funny white jackets that tie in the back???
 
=> * for that Catadmin - did the trick


Rgds, Geoff

Three things are certain. Death, taxes and lost data. DPlank is to blame

Please read FAQ222-2244 before you ask a question
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top