Dcount with date criteria

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have the following dcount line

=DCount("[VConsent]","[dailyRpt]","[EmpID]=" & [EmpID] & " And
[VConsent]=true")

My query has the field [date] and the criteria is [when?) how will add date
in the dcount, bcoz I want to run the query for a specific date only

Please help!
 
To add a date filter try this

=DCount("[VConsent]","[dailyRpt]","[EmpID]=" & [EmpID] & " And
[VConsent]=true AND [Date]= #" & MyDateParam & "#")
 
Thanks for the reply I tried and I am getting an error, below is my query and
the dcount stament in my report!

**********************************************************
=DCount("[VConsent]","[dailyRpt]","[EmpID]=" & [EmpID] & " And
[VConsent]=yes and [Date]= #" & [When?] & "#")

*********************************************************
SELECT Assign.Date, Assign.EmpID, Assign.VConsent FROM Assign WHERE
(((Assign.Date)=[When?]));

***********************************************************



Ofer said:
To add a date filter try this

=DCount("[VConsent]","[dailyRpt]","[EmpID]=" & [EmpID] & " And
[VConsent]=true AND [Date]= #" & MyDateParam & "#")


JOM said:
I have the following dcount line

=DCount("[VConsent]","[dailyRpt]","[EmpID]=" & [EmpID] & " And
[VConsent]=true")

My query has the field [date] and the criteria is [when?) how will add date
in the dcount, bcoz I want to run the query for a specific date only

Please help!
 
Change the dcount to
=DCount("[VConsent]","[dailyRpt]","[EmpID]=" & [EmpID] & " And
[VConsent]=yes and [Date]= #" & [DateFieldNameInTheReport] & "#")

It wont recognize the [When?] you created the source of the query, but it
does recognise the [date] filed you filtered on.

JOM said:
Thanks for the reply I tried and I am getting an error, below is my query and
the dcount stament in my report!

**********************************************************
=DCount("[VConsent]","[dailyRpt]","[EmpID]=" & [EmpID] & " And
[VConsent]=yes and [Date]= #" & [When?] & "#")

*********************************************************
SELECT Assign.Date, Assign.EmpID, Assign.VConsent FROM Assign WHERE
(((Assign.Date)=[When?]));

***********************************************************



Ofer said:
To add a date filter try this

=DCount("[VConsent]","[dailyRpt]","[EmpID]=" & [EmpID] & " And
[VConsent]=true AND [Date]= #" & MyDateParam & "#")


JOM said:
I have the following dcount line

=DCount("[VConsent]","[dailyRpt]","[EmpID]=" & [EmpID] & " And
[VConsent]=true")

My query has the field [date] and the criteria is [when?) how will add date
in the dcount, bcoz I want to run the query for a specific date only

Please help!
 
Thanks for the reply................

This will work well only when I dont put the criteria [when?] in the query,
when I add the criterial, I have errors in the dcount... So am not if am
missing something in your answer that am not doing, coz I even thought that
maybe date is sensitive in MS Access so I changed date which was my field
name in the table to dates and still getting errors!




Ofer said:
Change the dcount to
=DCount("[VConsent]","[dailyRpt]","[EmpID]=" & [EmpID] & " And
[VConsent]=yes and [Date]= #" & [DateFieldNameInTheReport] & "#")

It wont recognize the [When?] you created the source of the query, but it
does recognise the [date] filed you filtered on.

JOM said:
Thanks for the reply I tried and I am getting an error, below is my query and
the dcount stament in my report!

**********************************************************
=DCount("[VConsent]","[dailyRpt]","[EmpID]=" & [EmpID] & " And
[VConsent]=yes and [Date]= #" & [When?] & "#")

*********************************************************
SELECT Assign.Date, Assign.EmpID, Assign.VConsent FROM Assign WHERE
(((Assign.Date)=[When?]));

***********************************************************



Ofer said:
To add a date filter try this

=DCount("[VConsent]","[dailyRpt]","[EmpID]=" & [EmpID] & " And
[VConsent]=true AND [Date]= #" & MyDateParam & "#")


:

I have the following dcount line

=DCount("[VConsent]","[dailyRpt]","[EmpID]=" & [EmpID] & " And
[VConsent]=true")

My query has the field [date] and the criteria is [when?) how will add date
in the dcount, bcoz I want to run the query for a specific date only

Please help!
 
Can you tell me what is the error message you get.
Post again the dcount code.

JOM said:
Thanks for the reply................

This will work well only when I dont put the criteria [when?] in the query,
when I add the criterial, I have errors in the dcount... So am not if am
missing something in your answer that am not doing, coz I even thought that
maybe date is sensitive in MS Access so I changed date which was my field
name in the table to dates and still getting errors!




Ofer said:
Change the dcount to
=DCount("[VConsent]","[dailyRpt]","[EmpID]=" & [EmpID] & " And
[VConsent]=yes and [Date]= #" & [DateFieldNameInTheReport] & "#")

It wont recognize the [When?] you created the source of the query, but it
does recognise the [date] filed you filtered on.

JOM said:
Thanks for the reply I tried and I am getting an error, below is my query and
the dcount stament in my report!

**********************************************************
=DCount("[VConsent]","[dailyRpt]","[EmpID]=" & [EmpID] & " And
[VConsent]=yes and [Date]= #" & [When?] & "#")

*********************************************************
SELECT Assign.Date, Assign.EmpID, Assign.VConsent FROM Assign WHERE
(((Assign.Date)=[When?]));

***********************************************************



:

To add a date filter try this

=DCount("[VConsent]","[dailyRpt]","[EmpID]=" & [EmpID] & " And
[VConsent]=true AND [Date]= #" & MyDateParam & "#")


:

I have the following dcount line

=DCount("[VConsent]","[dailyRpt]","[EmpID]=" & [EmpID] & " And
[VConsent]=true")

My query has the field [date] and the criteria is [when?) how will add date
in the dcount, bcoz I want to run the query for a specific date only

Please help!
 
Ok here is the dcount statement (the unbound textbox in the report says
#Error that is it)

DCount("[VConsent]","[dailyRpt]","[EmpID]=" & [EmpID] & " And
[VConsent]=yes and [Dates]= #" & [Dates] & "#")

SELECT Assign.Dates, Assign.EmpID, Assign.VConsent
FROM Assign
WHERE (((Assign.Dates)=[when?]));


Dates is the field in the assign table and in the query too!

the query runs ok by itself, but the report runs ok too, but the dcount part
contains errors..

oj!




Ofer said:
Can you tell me what is the error message you get.
Post again the dcount code.

JOM said:
Thanks for the reply................

This will work well only when I dont put the criteria [when?] in the query,
when I add the criterial, I have errors in the dcount... So am not if am
missing something in your answer that am not doing, coz I even thought that
maybe date is sensitive in MS Access so I changed date which was my field
name in the table to dates and still getting errors!




Ofer said:
Change the dcount to
=DCount("[VConsent]","[dailyRpt]","[EmpID]=" & [EmpID] & " And
[VConsent]=yes and [Date]= #" & [DateFieldNameInTheReport] & "#")

It wont recognize the [When?] you created the source of the query, but it
does recognise the [date] filed you filtered on.

:

Thanks for the reply I tried and I am getting an error, below is my query and
the dcount stament in my report!

**********************************************************
=DCount("[VConsent]","[dailyRpt]","[EmpID]=" & [EmpID] & " And
[VConsent]=yes and [Date]= #" & [When?] & "#")

*********************************************************
SELECT Assign.Date, Assign.EmpID, Assign.VConsent FROM Assign WHERE
(((Assign.Date)=[When?]));

***********************************************************



:

To add a date filter try this

=DCount("[VConsent]","[dailyRpt]","[EmpID]=" & [EmpID] & " And
[VConsent]=true AND [Date]= #" & MyDateParam & "#")


:

I have the following dcount line

=DCount("[VConsent]","[dailyRpt]","[EmpID]=" & [EmpID] & " And
[VConsent]=true")

My query has the field [date] and the criteria is [when?) how will add date
in the dcount, bcoz I want to run the query for a specific date only

Please help!
 
1. Is the dailyRpt is a name of a table or a query? I hope it is not the
report name, you can dcount on a table or query only, so mybe what you need is
=DCount("[VConsent]","[Assign]","[EmpID]=" & [EmpID] & " And
[VConsent]=yes and [Dates]= #" & [Dates] & "#")

2. Is EmpID is a number field type


JOM said:
Ok here is the dcount statement (the unbound textbox in the report says
#Error that is it)

DCount("[VConsent]","[dailyRpt]","[EmpID]=" & [EmpID] & " And
[VConsent]=yes and [Dates]= #" & [Dates] & "#")

SELECT Assign.Dates, Assign.EmpID, Assign.VConsent
FROM Assign
WHERE (((Assign.Dates)=[when?]));


Dates is the field in the assign table and in the query too!

the query runs ok by itself, but the report runs ok too, but the dcount part
contains errors..

oj!




Ofer said:
Can you tell me what is the error message you get.
Post again the dcount code.

JOM said:
Thanks for the reply................

This will work well only when I dont put the criteria [when?] in the query,
when I add the criterial, I have errors in the dcount... So am not if am
missing something in your answer that am not doing, coz I even thought that
maybe date is sensitive in MS Access so I changed date which was my field
name in the table to dates and still getting errors!




:

Change the dcount to
=DCount("[VConsent]","[dailyRpt]","[EmpID]=" & [EmpID] & " And
[VConsent]=yes and [Date]= #" & [DateFieldNameInTheReport] & "#")

It wont recognize the [When?] you created the source of the query, but it
does recognise the [date] filed you filtered on.

:

Thanks for the reply I tried and I am getting an error, below is my query and
the dcount stament in my report!

**********************************************************
=DCount("[VConsent]","[dailyRpt]","[EmpID]=" & [EmpID] & " And
[VConsent]=yes and [Date]= #" & [When?] & "#")

*********************************************************
SELECT Assign.Date, Assign.EmpID, Assign.VConsent FROM Assign WHERE
(((Assign.Date)=[When?]));

***********************************************************



:

To add a date filter try this

=DCount("[VConsent]","[dailyRpt]","[EmpID]=" & [EmpID] & " And
[VConsent]=true AND [Date]= #" & MyDateParam & "#")


:

I have the following dcount line

=DCount("[VConsent]","[dailyRpt]","[EmpID]=" & [EmpID] & " And
[VConsent]=true")

My query has the field [date] and the criteria is [when?) how will add date
in the dcount, bcoz I want to run the query for a specific date only

Please help!
 
dailyrpt is the name of the query and empID is the Primary Key in the
employee table....

Ofer said:
1. Is the dailyRpt is a name of a table or a query? I hope it is not the
report name, you can dcount on a table or query only, so mybe what you need is
=DCount("[VConsent]","[Assign]","[EmpID]=" & [EmpID] & " And
[VConsent]=yes and [Dates]= #" & [Dates] & "#")

2. Is EmpID is a number field type


JOM said:
Ok here is the dcount statement (the unbound textbox in the report says
#Error that is it)

DCount("[VConsent]","[dailyRpt]","[EmpID]=" & [EmpID] & " And
[VConsent]=yes and [Dates]= #" & [Dates] & "#")

SELECT Assign.Dates, Assign.EmpID, Assign.VConsent
FROM Assign
WHERE (((Assign.Dates)=[when?]));


Dates is the field in the assign table and in the query too!

the query runs ok by itself, but the report runs ok too, but the dcount part
contains errors..

oj!




Ofer said:
Can you tell me what is the error message you get.
Post again the dcount code.

:

Thanks for the reply................

This will work well only when I dont put the criteria [when?] in the query,
when I add the criterial, I have errors in the dcount... So am not if am
missing something in your answer that am not doing, coz I even thought that
maybe date is sensitive in MS Access so I changed date which was my field
name in the table to dates and still getting errors!




:

Change the dcount to
=DCount("[VConsent]","[dailyRpt]","[EmpID]=" & [EmpID] & " And
[VConsent]=yes and [Date]= #" & [DateFieldNameInTheReport] & "#")

It wont recognize the [When?] you created the source of the query, but it
does recognise the [date] filed you filtered on.

:

Thanks for the reply I tried and I am getting an error, below is my query and
the dcount stament in my report!

**********************************************************
=DCount("[VConsent]","[dailyRpt]","[EmpID]=" & [EmpID] & " And
[VConsent]=yes and [Date]= #" & [When?] & "#")

*********************************************************
SELECT Assign.Date, Assign.EmpID, Assign.VConsent FROM Assign WHERE
(((Assign.Date)=[When?]));

***********************************************************



:

To add a date filter try this

=DCount("[VConsent]","[dailyRpt]","[EmpID]=" & [EmpID] & " And
[VConsent]=true AND [Date]= #" & MyDateParam & "#")


:

I have the following dcount line

=DCount("[VConsent]","[dailyRpt]","[EmpID]=" & [EmpID] & " And
[VConsent]=true")

My query has the field [date] and the criteria is [when?) how will add date
in the dcount, bcoz I want to run the query for a specific date only

Please help!
 
There is nothing wrong with the dcount statement, I can offer few things to
check.
1. Check the names
2. check the data type, if the EmpID field type is string then the decount
should look like that
DCount("[VConsent]","[dailyRpt]","[EmpID]='" & [EmpID] & "' And
[VConsent]=yes and [Dates]= #" & [Dates] & "#")
3. Is the VConsent field is Yes/No type, if its string then it should be
DCount("[VConsent]","[dailyRpt]","[EmpID]=" & [EmpID] & " And
[VConsent]='yes' and [Dates]= #" & [Dates] & "#")
4. Just in case, you can try and run the dcount with the immidiate windows,
and if you have an error it will display it
DCount("[VConsent]","[dailyRpt]","[EmpID]=122 And
[VConsent]=yes and [Dates]= #1/1/2005#")

Run it with proper data and see what the outcome


JOM said:
dailyrpt is the name of the query and empID is the Primary Key in the
employee table....

Ofer said:
1. Is the dailyRpt is a name of a table or a query? I hope it is not the
report name, you can dcount on a table or query only, so mybe what you need is
=DCount("[VConsent]","[Assign]","[EmpID]=" & [EmpID] & " And
[VConsent]=yes and [Dates]= #" & [Dates] & "#")

2. Is EmpID is a number field type


JOM said:
Ok here is the dcount statement (the unbound textbox in the report says
#Error that is it)

DCount("[VConsent]","[dailyRpt]","[EmpID]=" & [EmpID] & " And
[VConsent]=yes and [Dates]= #" & [Dates] & "#")

SELECT Assign.Dates, Assign.EmpID, Assign.VConsent
FROM Assign
WHERE (((Assign.Dates)=[when?]));


Dates is the field in the assign table and in the query too!

the query runs ok by itself, but the report runs ok too, but the dcount part
contains errors..

oj!




:

Can you tell me what is the error message you get.
Post again the dcount code.

:

Thanks for the reply................

This will work well only when I dont put the criteria [when?] in the query,
when I add the criterial, I have errors in the dcount... So am not if am
missing something in your answer that am not doing, coz I even thought that
maybe date is sensitive in MS Access so I changed date which was my field
name in the table to dates and still getting errors!




:

Change the dcount to
=DCount("[VConsent]","[dailyRpt]","[EmpID]=" & [EmpID] & " And
[VConsent]=yes and [Date]= #" & [DateFieldNameInTheReport] & "#")

It wont recognize the [When?] you created the source of the query, but it
does recognise the [date] filed you filtered on.

:

Thanks for the reply I tried and I am getting an error, below is my query and
the dcount stament in my report!

**********************************************************
=DCount("[VConsent]","[dailyRpt]","[EmpID]=" & [EmpID] & " And
[VConsent]=yes and [Date]= #" & [When?] & "#")

*********************************************************
SELECT Assign.Date, Assign.EmpID, Assign.VConsent FROM Assign WHERE
(((Assign.Date)=[When?]));

***********************************************************



:

To add a date filter try this

=DCount("[VConsent]","[dailyRpt]","[EmpID]=" & [EmpID] & " And
[VConsent]=true AND [Date]= #" & MyDateParam & "#")


:

I have the following dcount line

=DCount("[VConsent]","[dailyRpt]","[EmpID]=" & [EmpID] & " And
[VConsent]=true")

My query has the field [date] and the criteria is [when?) how will add date
in the dcount, bcoz I want to run the query for a specific date only

Please help!
 
Back
Top