What is an automation object error?

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().
 
B

boblarson

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.
__________________________________
 
N

NewAccessUser

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().
 
L

Linq Adams via AccessMonster.com

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Query Parameter 4
Me. 2
Error 2471 11
Access Property sheet data missing also syntax 0
Not sure what to do with this error 4
Access Access macro build gone wrong 0
Automation Error from Switchboard 2
#error in calculate age 4

Top