The Object Doesn't contain the Automation object 'Date'

W

weircolin

Hi

I am getting the following message up

You tried to runa Visual Basic Proceedure to set a property or method
for an object, however, the component doesn't make the property or
method available for automation operations.


Check the component's documentation for information on the properties
and methods it make available for Automation operations.

When I try to use the code

=DCount("Reference Number","Newsletter Database",Year([Date]) & " -
[Year Born] Between " & 18 & " And " & 25)

Does anyone have any ideas!?

Thanks

Colin
 
B

Brendan Reynolds

The square brackets indicate that 'Date' is a control or property of your
form. If you intended to refer to the Date function, remove the square
brackets.
 
W

weircolin

Hi

Thanks for your reply. One of the problems is that the square brackets
appear themselves! When I take them away it still doesn't work.

Thanks

Colin
Brendan said:
The square brackets indicate that 'Date' is a control or property of your
form. If you intended to refer to the Date function, remove the square
brackets.

--
Brendan Reynolds
Access MVP


Hi

I am getting the following message up

You tried to runa Visual Basic Proceedure to set a property or method
for an object, however, the component doesn't make the property or
method available for automation operations.


Check the component's documentation for information on the properties
and methods it make available for Automation operations.

When I try to use the code

=DCount("Reference Number","Newsletter Database",Year([Date]) & " -
[Year Born] Between " & 18 & " And " & 25)

Does anyone have any ideas!?

Thanks

Colin
 
B

Brendan Reynolds

If you're having trouble entering the expression without the square brackets
around 'Date' try entering it as 'Date()', e.g. ...

=DCount("Reference Number","Newsletter Database",Year(Date()) & " - [Year
Born] Between " & 18 & " And " & 25)

You may find that Access removes the parentheses after Date, but they should
be enough to prevent Access from adding the square brackets.

If that still doesn't solve your problem, can you post your expression as it
looks now, with the square brackets removed, and can you also clarify
whether you are still getting the same error message or a different one?

--
Brendan Reynolds
Access MVP


Hi

Thanks for your reply. One of the problems is that the square brackets
appear themselves! When I take them away it still doesn't work.

Thanks

Colin
Brendan said:
The square brackets indicate that 'Date' is a control or property of your
form. If you intended to refer to the Date function, remove the square
brackets.

--
Brendan Reynolds
Access MVP


Hi

I am getting the following message up

You tried to runa Visual Basic Proceedure to set a property or method
for an object, however, the component doesn't make the property or
method available for automation operations.


Check the component's documentation for information on the properties
and methods it make available for Automation operations.

When I try to use the code

=DCount("Reference Number","Newsletter Database",Year([Date]) & " -
[Year Born] Between " & 18 & " And " & 25)

Does anyone have any ideas!?

Thanks

Colin
 
W

weircolin

Hi Brendan

Thanks for replying again.

My code is now the following

=DCount("Reference Number","Newsletter Database",Year(Date()) & " -
[Year Born] Between " & 18 & " And " & 25)

I'm getting no error message but the text box is saying #Name?

Thanks again

Colin
Brendan said:
If you're having trouble entering the expression without the square brackets
around 'Date' try entering it as 'Date()', e.g. ...

=DCount("Reference Number","Newsletter Database",Year(Date()) & " - [Year
Born] Between " & 18 & " And " & 25)

You may find that Access removes the parentheses after Date, but they should
be enough to prevent Access from adding the square brackets.

If that still doesn't solve your problem, can you post your expression as it
looks now, with the square brackets removed, and can you also clarify
whether you are still getting the same error message or a different one?

--
Brendan Reynolds
Access MVP


Hi

Thanks for your reply. One of the problems is that the square brackets
appear themselves! When I take them away it still doesn't work.

Thanks

Colin
Brendan said:
The square brackets indicate that 'Date' is a control or property of your
form. If you intended to refer to the Date function, remove the square
brackets.

--
Brendan Reynolds
Access MVP


Hi

I am getting the following message up

You tried to runa Visual Basic Proceedure to set a property or method
for an object, however, the component doesn't make the property or
method available for automation operations.


Check the component's documentation for information on the properties
and methods it make available for Automation operations.

When I try to use the code

=DCount("Reference Number","Newsletter Database",Year([Date]) & " -
[Year Born] Between " & 18 & " And " & 25)

Does anyone have any ideas!?

Thanks

Colin
 
B

Brendan Reynolds

Ironically enough, you probably need to *add* some square brackets, around
'Reference Number' and 'Newsletter Database', because of the spaces in those
names.

=DCount("[Reference Number]","[Newsletter Database]",Year(Date()) & " -
[Year Born] Between " & 18 & " And " & 25)

--
Brendan Reynolds
Access MVP

Hi Brendan

Thanks for replying again.

My code is now the following

=DCount("Reference Number","Newsletter Database",Year(Date()) & " -
[Year Born] Between " & 18 & " And " & 25)

I'm getting no error message but the text box is saying #Name?

Thanks again

Colin
Brendan said:
If you're having trouble entering the expression without the square
brackets
around 'Date' try entering it as 'Date()', e.g. ...

=DCount("Reference Number","Newsletter Database",Year(Date()) & " -
[Year
Born] Between " & 18 & " And " & 25)

You may find that Access removes the parentheses after Date, but they
should
be enough to prevent Access from adding the square brackets.

If that still doesn't solve your problem, can you post your expression as
it
looks now, with the square brackets removed, and can you also clarify
whether you are still getting the same error message or a different one?

--
Brendan Reynolds
Access MVP


Hi

Thanks for your reply. One of the problems is that the square brackets
appear themselves! When I take them away it still doesn't work.

Thanks

Colin
Brendan Reynolds wrote:
The square brackets indicate that 'Date' is a control or property of
your
form. If you intended to refer to the Date function, remove the square
brackets.

--
Brendan Reynolds
Access MVP


Hi

I am getting the following message up

You tried to runa Visual Basic Proceedure to set a property or
method
for an object, however, the component doesn't make the property or
method available for automation operations.


Check the component's documentation for information on the
properties
and methods it make available for Automation operations.

When I try to use the code

=DCount("Reference Number","Newsletter Database",Year([Date]) & " -
[Year Born] Between " & 18 & " And " & 25)

Does anyone have any ideas!?

Thanks

Colin
 
W

weircolin

Hi there

Thatnks for replying.

I've got it working now, this is what I used.

=DCount("[Reference Number]","[Newsletter Database]"," [Newsletter
Database]![Year Born] between (Year(Now()) - 18 ) and (Year(Now()) - 25
) ")

Thanks again

Colin
Brendan said:
Ironically enough, you probably need to *add* some square brackets, around
'Reference Number' and 'Newsletter Database', because of the spaces in those
names.

=DCount("[Reference Number]","[Newsletter Database]",Year(Date()) & " -
[Year Born] Between " & 18 & " And " & 25)

--
Brendan Reynolds
Access MVP

Hi Brendan

Thanks for replying again.

My code is now the following

=DCount("Reference Number","Newsletter Database",Year(Date()) & " -
[Year Born] Between " & 18 & " And " & 25)

I'm getting no error message but the text box is saying #Name?

Thanks again

Colin
Brendan said:
If you're having trouble entering the expression without the square
brackets
around 'Date' try entering it as 'Date()', e.g. ...

=DCount("Reference Number","Newsletter Database",Year(Date()) & " -
[Year
Born] Between " & 18 & " And " & 25)

You may find that Access removes the parentheses after Date, but they
should
be enough to prevent Access from adding the square brackets.

If that still doesn't solve your problem, can you post your expression as
it
looks now, with the square brackets removed, and can you also clarify
whether you are still getting the same error message or a different one?

--
Brendan Reynolds
Access MVP


Hi

Thanks for your reply. One of the problems is that the square brackets
appear themselves! When I take them away it still doesn't work.

Thanks

Colin
Brendan Reynolds wrote:
The square brackets indicate that 'Date' is a control or property of
your
form. If you intended to refer to the Date function, remove the square
brackets.

--
Brendan Reynolds
Access MVP


Hi

I am getting the following message up

You tried to runa Visual Basic Proceedure to set a property or
method
for an object, however, the component doesn't make the property or
method available for automation operations.


Check the component's documentation for information on the
properties
and methods it make available for Automation operations.

When I try to use the code

=DCount("Reference Number","Newsletter Database",Year([Date]) & " -
[Year Born] Between " & 18 & " And " & 25)

Does anyone have any ideas!?

Thanks

Colin
 

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

Top