Dcount()

E

Ezekiël

Anyone knows how to sum the double records in a dcount() function.
I have this Dcount("[id];"[field1]";"Sum([id]=>1")

That did not work, somebody can correct me?
 
M

Michel Walsh

Hi,

The arguments must be separated by ; (assuming ; is your list
separator), but a ; included inside a string does not count as an argument
delimiter. A string starts with a " and ends with a ".

So, your first argument is probably "[id]" and then, the semi colon.
The " after the ] is required to end the string, BEFORE you use the ;

The second argument is a table name. I doubt field1 is a table name.

The third argument should be a valid criteria for a WHERE clause,

Sum([id] => 1

is not a valid criteria for a where clause. A closing parenthesis is
missing, and an aggregate, here Sum, cannot appear in a WHERE clause.

DCount( "aFieldOrAnExpressionHere" ; "tableNameHere" ;
"aCriteriaHere" )


would be a valid expression. WHAT result are you expecting (rather than HOW
you are trying to get it)?



Hoping it may help,
Vanderghast, Access MVP
 
E

Ezekiël

Hi Michel,

What i want is to sum up the count of [id].


Michel Walsh said:
Hi,

The arguments must be separated by ; (assuming ; is your list
separator), but a ; included inside a string does not count as an argument
delimiter. A string starts with a " and ends with a ".

So, your first argument is probably "[id]" and then, the semi colon.
The " after the ] is required to end the string, BEFORE you use the ;

The second argument is a table name. I doubt field1 is a table name.

The third argument should be a valid criteria for a WHERE clause,

Sum([id] => 1

is not a valid criteria for a where clause. A closing parenthesis is
missing, and an aggregate, here Sum, cannot appear in a WHERE clause.

DCount( "aFieldOrAnExpressionHere" ; "tableNameHere" ;
"aCriteriaHere" )


would be a valid expression. WHAT result are you expecting (rather than HOW
you are trying to get it)?



Hoping it may help,
Vanderghast, Access MVP


Ezekiël said:
Anyone knows how to sum the double records in a dcount() function.
I have this Dcount("[id];"[field1]";"Sum([id]=>1")

That did not work, somebody can correct me?
 
M

Michel Walsh

Hi,



The count of ID is already a number, as example, let say there is 1622
ID. What is left to be summed, in that circumstance?


Table1 ' tableName

Id, SomeQty ' fields
1 14
2 11
3 7
4 9
3 3 ' data



What would be the expected result?



Hoping it may help,
Vanderghast, Access MVP


Ezekiël said:
Hi Michel,

What i want is to sum up the count of [id].


Michel Walsh said:
Hi,

The arguments must be separated by ; (assuming ; is your list
separator), but a ; included inside a string does not count as an argument
delimiter. A string starts with a " and ends with a ".

So, your first argument is probably "[id]" and then, the semi colon.
The " after the ] is required to end the string, BEFORE you use the ;

The second argument is a table name. I doubt field1 is a table name.

The third argument should be a valid criteria for a WHERE clause,

Sum([id] => 1

is not a valid criteria for a where clause. A closing parenthesis is
missing, and an aggregate, here Sum, cannot appear in a WHERE clause.

DCount( "aFieldOrAnExpressionHere" ; "tableNameHere" ;
"aCriteriaHere" )


would be a valid expression. WHAT result are you expecting (rather than HOW
you are trying to get it)?



Hoping it may help,
Vanderghast, Access MVP


Ezekiël said:
Anyone knows how to sum the double records in a dcount() function.
I have this Dcount("[id];"[field1]";"Sum([id]=>1")

That did not work, somebody can correct me?
 

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