Conditional Recordcount

S

Shiller

Experts,

I'm trying to get a record count based on the value in the combox.
For example if 2 records are marked "completed" out of 5, I want 2 as
my record count.

Please help!

thanks
 
D

Dennis

I don't understand. The RecordCount is a PROPERTY of a recordset, and is only
available to you when you create and open a recordset. You cannot "set" its
value to something.
 
F

fredg

Experts,

I'm trying to get a record count based on the value in the combox.
For example if 2 records are marked "completed" out of 5, I want 2 as
my record count.

Please help!

thanks

it's not clear at all what you are asking.
Perhaps you mean.......
Using an unbound text control on your form:

=DCount("*","TableName","[FieldInTable] = '" & [ComboName] & "'"

The above assumes the [FieldInTable] datatype is Text.

If it is a Number datatype, then use:

=DCount("*","TableName","[FieldInTable] = " & [ComboName]
 
S

Shiller

I'm trying to get a record count based on the value in the combox.
For example if 2 records are marked "completed" out of 5, I want 2 as
my record count.
Please help!

it's not clear at all what you are asking.
Perhaps you mean.......
Using an unbound text control on your form:

=DCount("*","TableName","[FieldInTable] = '" & [ComboName] & "'"

The above assumes the [FieldInTable] datatype is Text.

If it is a Number datatype, then use:

=DCount("*","TableName","[FieldInTable] = " & [ComboName]

I'm trying to get the counts from a combobox on my subform based on
certain criteria. I've been experimenting with this piece of code
that supposedly can do that but it's not working:

DCount("*", Me.SubformName.Form.RecordSource,
IIf(Me.SubformName.Form.Filter = "", "", Me.SubformName.Form.Filter &
" And Len([Criteria] & """") > 0")
 
S

Shiller

it's not clear at all what you are asking.
Perhaps you mean.......
Using an unbound text control on your form:
=DCount("*","TableName","[FieldInTable] = '" & [ComboName] & "'"
The above assumes the [FieldInTable] datatype is Text.
If it is a Number datatype, then use:
=DCount("*","TableName","[FieldInTable] = " & [ComboName]

I'm trying to get the counts from a combobox on my subform based on
certain criteria. I've been experimenting with this piece of code
that supposedly can do that but it's not working:

DCount("*", Me.SubformName.Form.RecordSource,
IIf(Me.SubformName.Form.Filter = "", "", Me.SubformName.Form.Filter &
" And Len([Criteria] & """") > 0")

I took a simpler approach, I created separate queries with different
criteria to update the table a criteria at a time.
 

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