473,395 Members | 1,539 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Countif Query - Finding Unique Entries

Hi All,

Ok I have a table [TblItems]- it lists items with a unique reference
code; lets say there are 4 items [RefCode]:

Item RefCode
1 ABC1
2 ABC2
3 ABC3
4 ABC4

I have a query [QryUnavail] that does some calculations on other
tables and tells me which items are currently unavialble - this puts
the RefCode of unavailable items into a column [UnavailableItems]; for
example if ABC2 was unavailable

<code <code UnavailableItems
...... .... ABC2

What I need is another query which list all items which are currently
available, so ABC1, ABC3 and ABC4 in this case.

I thought that if I have a query that lists all [RefCodes], except
where the countif of that [RefCode] in the column [UnavailableItems]
is greater than 1, I could achive this but I can't work out how to
achieve this.

I'm an access newbie but in using what I know coupled with Excel type
formula structure this whould be something like:

Countif([QryUnavail]![UnavailableItems],[RefCode])

I could then use the criteria ="0" to show only available items

Any help appreciated,

Thanks, JW191
Jun 27 '08 #1
4 3105
On May 19, 11:20*am, jameswilkinson...@googlemail.com wrote:
Hi All,

Ok I have a table [TblItems]- it lists items with a unique reference
code; lets say there are 4 items [RefCode]:

Item * * * * * RefCode
1 * * * * * * * *ABC1
2 * * * * * * * *ABC2
3 * * * * * * * *ABC3
4 * * * * * * * *ABC4

I have a query [QryUnavail] that does some calculations on other
tables and tells me which items are currently unavialble - this puts
the RefCode of unavailable items into a column [UnavailableItems]; for
example if ABC2 was unavailable

<code*<code* * * UnavailableItems
..... * * * *.... * * * * * * *ABC2

What I need is another query which list all items which are currently
available, so ABC1, ABC3 and ABC4 in this case.

I thought that if I have a query that lists all [RefCodes], except
where the countif of that [RefCode] in the column [UnavailableItems]
is greater than 1, I could achive this but I can't work out how to
achieve this.

I'm an access newbie but in using what I know coupled with Excel type
formula structure this whould be something like:

Countif([QryUnavail]![UnavailableItems],[RefCode])

I could then use the criteria ="0" to show only available items

Any help appreciated,

Thanks, JW191
If an Unmatched Query won't work, take a look here:

http://groups.google.com/group/comp....7861ecfba44820

If that doesn't help, post back.

James A. Fortune
CD********@FortuneJames.com
Jun 27 '08 #2
On May 20, 4:28*pm, CDMAPos...@fortunejames.com wrote:
On May 19, 11:20*am, jameswilkinson...@googlemail.com wrote:


Hi All,
Ok I have a table [TblItems]- it lists items with a unique reference
code; lets say there are 4 items [RefCode]:
Item * * * * * RefCode
1 * * * * * * * *ABC1
2 * * * * * * * *ABC2
3 * * * * * * * *ABC3
4 * * * * * * * *ABC4
I have a query [QryUnavail] that does some calculations on other
tables and tells me which items are currently unavialble - this puts
the RefCode of unavailable items into a column [UnavailableItems]; for
example if ABC2 was unavailable
<code*<code* * * UnavailableItems
..... * * * *.... * * * * * * *ABC2
What I need is another query which list all items which are currently
available, so ABC1, ABC3 and ABC4 in this case.
I thought that if I have a query that lists all [RefCodes], except
where the countif of that [RefCode] in the column [UnavailableItems]
is greater than 1, I could achive this but I can't work out how to
achieve this.
I'm an access newbie but in using what I know coupled with Excel type
formula structure this whould be something like:
Countif([QryUnavail]![UnavailableItems],[RefCode])
I could then use the criteria ="0" to show only available items
Any help appreciated,
Thanks, JW191

If an Unmatched Query won't work, take a look here:

http://groups.google.com/group/comp..../browse_frm/th...

If that doesn't help, post back.

James A. Fortune
CDMAPos...@FortuneJames.com- Hide quoted text -

- Show quoted text -
Unfortunately Im still stuck here. Is there an easy way of showing all
refcodes in one column, and the count of thos RefCodes from a column
in another query. The I can simply filter where the count is zero? So
for above example unfiltered:

RefCode Count UnavailableItems
ABC1 0
ABC2 1
ABC3 0
ABC4 0

And Filtered (i.e. showing available):

RefCode Count UnavailableItems
ABC1 0
ABC3 0
ABC4 0

Thanks,
JW
Jun 27 '08 #3
Hello,

There is a useful sentence that you can use in your queries: ‘HAVING’
The way to use it is:

SELECT Field1, Field2
FROM Table1
GROUP BY Field1
HAVING Field1 0

Try that, maybe you will resolve your problem.
Jun 27 '08 #4
ja***************@googlemail.com wrote:
On May 20, 4:28 pm, CDMAPos...@fortunejames.com wrote:
>>On May 19, 11:20 am, jameswilkinson...@googlemail.com wrote:

>>>Hi All,
>>>Ok I have a table [TblItems]- it lists items with a unique reference
code; lets say there are 4 items [RefCode]:
>>>Item RefCode
1 ABC1
2 ABC2
3 ABC3
4 ABC4
>>>I have a query [QryUnavail] that does some calculations on other
tables and tells me which items are currently unavialble - this puts
the RefCode of unavailable items into a column [UnavailableItems]; for
example if ABC2 was unavailable
>>><code <code UnavailableItems
..... .... ABC2
>>>What I need is another query which list all items which are currently
available, so ABC1, ABC3 and ABC4 in this case.
>>>I thought that if I have a query that lists all [RefCodes], except
where the countif of that [RefCode] in the column [UnavailableItems]
is greater than 1, I could achive this but I can't work out how to
achieve this.
>>>I'm an access newbie but in using what I know coupled with Excel type
formula structure this whould be something like:
>>>Countif([QryUnavail]![UnavailableItems],[RefCode])
>>>I could then use the criteria ="0" to show only available items
>>>Any help appreciated,
>>>Thanks, JW191

If an Unmatched Query won't work, take a look here:

http://groups.google.com/group/comp..../browse_frm/th...

If that doesn't help, post back.

James A. Fortune
CDMAPos...@FortuneJames.com- Hide quoted text -

- Show quoted text -


Unfortunately Im still stuck here. Is there an easy way of showing all
refcodes in one column, and the count of thos RefCodes from a column
in another query. The I can simply filter where the count is zero? So
for above example unfiltered:

RefCode Count UnavailableItems
ABC1 0
ABC2 1
ABC3 0
ABC4 0

And Filtered (i.e. showing available):

RefCode Count UnavailableItems
ABC1 0
ABC3 0
ABC4 0

Thanks,
JW
Let's say you have a table of RefCodes and a query of RefCodes with
Counts. Open up the querybuilder (Query/Design/New) and add both
tables. Create a relationship between the two by dragging Refcode from
Refcodes table to the query's Refcode. Now DlbClick on the line and set
it to All in Refcodes and matching in Query. Then drag the Refcode from
Refcodes into 1 column and the count from the query. You'll get a Null
from those without a count. You can create a calculated column to
display a 0 if needed. Something like
QCnt : IIF(Not IsNull(Query1!Refcnt,Query1!Refcnt,0)

Monkey Dance
http://www.youtube.com/watch?v=cLM5-2vZbgo
Jun 27 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: mr_burns | last post by:
hi, i am wanting to count the number of unique rows under a certain column. i want to count how many times a page has been accessed. how i plan to do this is every time a page is accessed, a...
3
by: David Berry | last post by:
Hi All. I'm trying to write an ASP page that shows me the UNIQUE account number for a customer (so I can pass it to another page) based on a search criteria. For example, I want to do a select...
1
by: windandwaves | last post by:
Hi Gurus I am trying to make a table with unique entries. Problem is, the entries are upto 1000 characters long. Can I still apply a unique index and how and if so, what field type should I...
1
by: Turtle | last post by:
I have an xml file which represents a data table with several fields. I want to extract a list of unique entries in one particular field. What's the best way to do this? TIA! - Turtle
1
by: Astra | last post by:
Hi All Strange request I know, but could somebody give me pointers on how I can put 3 queries into 1 'thing' and then get only the unique entries from this 'thing'. To explain, I'm using...
2
by: Jimmy Stewart | last post by:
Ok, I'm trying to write a query that is starting to wear me down. What I'm trying to do is create a year end report that gets sent to all of my customers who meet two criteria. One they are...
6
by: hinksta | last post by:
I'm trying to build a football leage table taking it's content from a results database, CREATE TABLE conference ( id int NOT NULL auto_increment primary key, season VARCHAR(50) NOT NULL, ...
1
by: escapersky | last post by:
I have a database that i've been entering and I need to show how many unique entries I have entered prividing the date range. The database includes date, productID, locationID, quantity etc. ...
3
by: medic29 | last post by:
Hello, I have a query listed below which works but... The data below is what the query displays. There are hundreds of records I am bringing up and each one has between 3-6 entries displayed in...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.