What is an automation object error?

  • Thread starter Thread starter NewAccessUser
  • Start date Start date
N

NewAccessUser

This is the error message I received when I tried to build an expression
using date parameters. I used:

=DateDiff("yyyy",[Date()],[Employee Listing]![Hire Date])

This is the error message:
"The expression On Format you entered as the event property setting produced
the following error: The object doesn't contain the Automation object
'Date().
 
Get rid of the square brackets around Date() and also reverse the dates as
you will get a negative number if you don't:

=DateDiff("yyyy",[Employee Listing]![Hire Date],Date())

--
Bob Larson
Access World Forums Super Moderator
Utter Access VIP
Tutorials at http://www.btabdevelopment.com
If my post was helpful to you, please rate the post.
__________________________________
 
Thank you for the tip. I reversed and did not get the error message,
however, the data did not populate when I ran the report. What am I missing?

boblarson said:
Get rid of the square brackets around Date() and also reverse the dates as
you will get a negative number if you don't:

=DateDiff("yyyy",[Employee Listing]![Hire Date],Date())

--
Bob Larson
Access World Forums Super Moderator
Utter Access VIP
Tutorials at http://www.btabdevelopment.com
If my post was helpful to you, please rate the post.
__________________________________


NewAccessUser said:
This is the error message I received when I tried to build an expression
using date parameters. I used:

=DateDiff("yyyy",[Date()],[Employee Listing]![Hire Date])

This is the error message:
"The expression On Format you entered as the event property setting produced
the following error: The object doesn't contain the Automation object
'Date().
 
This is really identical to calculating a person's age, and as such the
formula

=DateDiff("yyyy",[Employee Listing]![Hire Date],Date())

will often give you false values! The problem is that DateDiff() using the
"yyyy" qualifier calculates the difference between the years in the two dates
supplied.

If you have a person hired on 12/31/2000 and you run this calculation on
1/1/2008 it will show their length of service as 8 years (2008 - 2000) when
actually their length of service is 7 years and 1 day!

For an accurate length of service try:

DateDiff("yyyy", [Employee Listing]![Hire Date], Date) - IIf(Format$(Date,
"mmdd") < Format$([Employee Listing]![Hire Date], "mmdd"), 1, 0)

Linq

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
 
Back
Top