DCount Difficulty

R

Rod

Hello,

I need to do the following:
1) Count all of the [CALL_ON] = today's date.
2) Separately count [CALL_ON] = today's date AND ([CALL_RESULTS] = "Message"
or ([CALL_RESULTS] = "CO"
3) Add "/" to the end.

#1 above works fine. My issue is with #2 above; I have not been able to
figure out how to do the AND in the above. Here is what the code looks like
so far, but it does not work:

Me.tbxResume_SF = Nz(DCount(Format(Date, "\#mm\/dd\/yyyy\#"),
"tblCandidates", "[CALLED_ON] = " & Format(Date, "\#mm\/dd\/yyyy\#") & " And
([CALL_RESULTS] = 'Message' or [CALL_RESULTS] = 'Corp Overview')"), 0) & "/"

Thanks.
 
C

Carl Rapson

When you say it 'does not work', what do you mean? Are you getting an error
message, or is the statement executing but you're not getting what you
expect? What is returned from the DCount?

As a quick note, if you are wanting a count of records, the first parameter
in DCount can be "*" rather than a specific field.

Carl Rapson
 
R

Rod

The first DCount returned: 0. The statement is executing, but I am not
getting what I want/expect

Carl Rapson said:
When you say it 'does not work', what do you mean? Are you getting an error
message, or is the statement executing but you're not getting what you
expect? What is returned from the DCount?

As a quick note, if you are wanting a count of records, the first parameter
in DCount can be "*" rather than a specific field.

Carl Rapson

Rod said:
Hello,

I need to do the following:
1) Count all of the [CALL_ON] = today's date.
2) Separately count [CALL_ON] = today's date AND ([CALL_RESULTS] =
"Message"
or ([CALL_RESULTS] = "CO"
3) Add "/" to the end.

#1 above works fine. My issue is with #2 above; I have not been able to
figure out how to do the AND in the above. Here is what the code looks
like
so far, but it does not work:

Me.tbxResume_SF = Nz(DCount(Format(Date, "\#mm\/dd\/yyyy\#"),
"tblCandidates", "[CALLED_ON] = " & Format(Date, "\#mm\/dd\/yyyy\#") & "
And
([CALL_RESULTS] = 'Message' or [CALL_RESULTS] = 'Corp Overview')"), 0) &
"/"

Thanks.
 
C

Carl Rapson

When you say that "Count all of the [CALL_ON] = today's date" works, does
that mean this:

DCount(Format(Date, "\#mm\/dd\/yyyy\#"), "tblCandidates", "[CALL_ON] = " &
Format(Date, "\#mm\/dd\/yyyy\#"))

returns a number other than zero? I can't spot anything wrong with the AND
clause, so are you absolutely certain that there are records where
[CALL_DATE]=today and [CALL_RESULTS]='Message' or 'Corp Overview'? Can you
enter the SQL as a SELECT statement (instead of DCount) in the Query builder
and get what you want?

Carl

Rod said:
The first DCount returned: 0. The statement is executing, but I am not
getting what I want/expect

Carl Rapson said:
When you say it 'does not work', what do you mean? Are you getting an
error
message, or is the statement executing but you're not getting what you
expect? What is returned from the DCount?

As a quick note, if you are wanting a count of records, the first
parameter
in DCount can be "*" rather than a specific field.

Carl Rapson

Rod said:
Hello,

I need to do the following:
1) Count all of the [CALL_ON] = today's date.
2) Separately count [CALL_ON] = today's date AND ([CALL_RESULTS] =
"Message"
or ([CALL_RESULTS] = "CO"
3) Add "/" to the end.

#1 above works fine. My issue is with #2 above; I have not been able
to
figure out how to do the AND in the above. Here is what the code looks
like
so far, but it does not work:

Me.tbxResume_SF = Nz(DCount(Format(Date, "\#mm\/dd\/yyyy\#"),
"tblCandidates", "[CALLED_ON] = " & Format(Date, "\#mm\/dd\/yyyy\#") &
"
And
([CALL_RESULTS] = 'Message' or [CALL_RESULTS] = 'Corp Overview')"), 0)
&
"/"

Thanks.
 
Top