Count based on a listbox values


G

Guest

I have a form who's record source is a query. On this form I have a list
box. In this list box is displaying record sets based on a date "Between
[Start Date] and [End Date]". There is also a field called [Status] which
contains some numeric values, i.e. 1, 2, 3 ... What I would like to do is
get a count of the number of [Status]=1 or [Status]=2 etc... based on the
List Box that is being displayed on the form. However if I use something
like "=Sum(IIf([Status]=4,1,0))" it returns the count from the record source
query and not the List box which is displayed on the form. How can I
display a count (in a text box) based on values in the List box and not the
record source of the form. Thanks.
 
Ad

Advertisements

J

Jeff Boyce

Remember that the list box doesn't hold the data, it just displays data
based on the underlying source.

Have you tried using the same source you use for the listbox in determining
the count?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
G

Guest

Thanks Jeff, the list box is filtering the data based on user input i.e date,
that's why I'm tring to get a count based on this filtered data.

Jeff Boyce said:
Remember that the list box doesn't hold the data, it just displays data
based on the underlying source.

Have you tried using the same source you use for the listbox in determining
the count?

Regards

Jeff Boyce
Microsoft Office/Access MVP


troon said:
I have a form who's record source is a query. On this form I have a list
box. In this list box is displaying record sets based on a date "Between
[Start Date] and [End Date]". There is also a field called [Status] which
contains some numeric values, i.e. 1, 2, 3 ... What I would like to do is
get a count of the number of [Status]=1 or [Status]=2 etc... based on the
List Box that is being displayed on the form. However if I use something
like "=Sum(IIf([Status]=4,1,0))" it returns the count from the record
source
query and not the List box which is displayed on the form. How can I
display a count (in a text box) based on values in the List box and not
the
record source of the form. Thanks.
 
Ad

Advertisements

J

Jeff Boyce

I was proposing that you use the same query, or another one, based on the
same selection criteria/filtering.

Regards

Jeff Boyce
Microsoft Office/Access MVP

troon said:
Thanks Jeff, the list box is filtering the data based on user input i.e
date,
that's why I'm tring to get a count based on this filtered data.

Jeff Boyce said:
Remember that the list box doesn't hold the data, it just displays data
based on the underlying source.

Have you tried using the same source you use for the listbox in
determining
the count?

Regards

Jeff Boyce
Microsoft Office/Access MVP


troon said:
I have a form who's record source is a query. On this form I have a
list
box. In this list box is displaying record sets based on a date
"Between
[Start Date] and [End Date]". There is also a field called [Status]
which
contains some numeric values, i.e. 1, 2, 3 ... What I would like to do
is
get a count of the number of [Status]=1 or [Status]=2 etc... based on
the
List Box that is being displayed on the form. However if I use
something
like "=Sum(IIf([Status]=4,1,0))" it returns the count from the record
source
query and not the List box which is displayed on the form. How can I
display a count (in a text box) based on values in the List box and not
the
record source of the form. Thanks.
 

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