Sunday, February 19, 2012

How do I display SQL Server 1/1/1900 dates as blank in Access?

Is there an easy way to tell Access (2000 or 2003) to display the "1/1/1900"
that SQL Server 2005 considers a blank date as blank rather than as
"1/1/1900"? I know I can create a function like that shown below to do it.
Public Function BlankDate(datInputDate)
If datInputDate < #1/2/1900# Then
BlankDate = ""
Else
BlankDate = datInputDate
End If
End Function
I'm just hoping there's a simpler more universal way to do it, either on the
Access side or the SQL Server 2005 side.
Thanks!
Michael
I thought that blank date was null.
You could try in your query using:
nullif(FieldName, '1/1/1900') as FieldName
Note that this will not be updatable.
Russel Loski, MCSD.Net
"Michael Nagan" wrote:

> Is there an easy way to tell Access (2000 or 2003) to display the "1/1/1900"
> that SQL Server 2005 considers a blank date as blank rather than as
> "1/1/1900"? I know I can create a function like that shown below to do it.
> Public Function BlankDate(datInputDate)
> If datInputDate < #1/2/1900# Then
> BlankDate = ""
> Else
> BlankDate = datInputDate
> End If
> End Function
> I'm just hoping there's a simpler more universal way to do it, either on the
> Access side or the SQL Server 2005 side.
> Thanks!
> Michael
>
>

No comments:

Post a Comment