TMGR: Using Literal Date Symbol # May Cause Run-time Error (149880)
The information in this article applies to:
This article was previously published under Q149880 SYMPTOMS
You may receive the following error message when you enclose literal dates
with the number sign characters (#) and pass an argument to a property or a
method, for example, #January 1, 01# or #1 Jan 01# for the date 1/1/2001:
Run-time error '1':
There was an OLE automation error.
CAUSE
When you enter a literal date, such as #1/1/00#, where you specify only the
last two digits of the year, Visual Basic for Applications interprets the
years 00-50 as years 1900-1950. If the year for a literal date is in that
range, a run-time error occurs because valid dates for Microsoft Team
Manager are from 1/1/1984 to 12-31-2050.
WORKAROUND
You can use one of the following methods to work around this behavior: - Use four digits to specify the year, for example, #1/1/2000#.
- Use a quoted string to represent your dates instead of a literal
date, for example, "1/1/00".
- Use the Visual Basic for Applications CStr function to convert the
literal date to string, for example, CStr(#1/1/00#).
| Modification Type: | Major | Last Reviewed: | 12/30/2005 |
|---|
| Keywords: | kberrmsg KB149880 |
|---|
|