I have a query that I want to count the number of records where the value of
a field "txtFactClients" is not 0. I have set up an expression "CountFC:
txtFactClients" with Count selected in the Total line and [txtFactClients]>0
in the criteria line but when I run the query it counts every record whether
or not it is 0. I've looked at previous post but they all seem to involve
SQL, is there a way of doing this in the design mode of a query?
TIA
Tony 13 1473
Tony,
Try this before you do anything else: Look at your query in SQL view. The
Query By Design in Access allows you to switch easily between SQL, Design
and Datasheet view. Put it to it's full use. You can do anything in SQL
view that you can do in Design View, and vice-versa (although some things
are easier to do in one than the other).
If you can't work out how to do something, switch to SQL View, copy the SQL
to the ng, and say exactly the results that you want. When you get your
answer, copy the SQL back to a new query in SQL View. Then switch back to
Design View if you want. IMHO, switching back and forth between the two is
one of the best ways to learn. Not that the SQL that Access generates is
perfect, but it works.
Darryl Kerkeslager
"Tony Williams" <tw@tcpinvalid.com> wrote in message
news:cs**********@titan.btinternet.com... I have a query that I want to count the number of records where the value
of a field "txtFactClients" is not 0. I have set up an expression "CountFC: txtFactClients" with Count selected in the Total line and
[txtFactClients]>0 in the criteria line but when I run the query it counts every record
whether or not it is 0. I've looked at previous post but they all seem to involve SQL, is there a way of doing this in the design mode of a query? TIA Tony
You need to remove [txtFactClients]>0 from the criteria line of your
field "CountFC:txtFactClients" and add the field txtFactClients,
choosing 'where' in the total line and >0 in the criteria line.
Mike
txtFactClients is probably a TEXT field and as such has string values, NOT
NUMBERS.
Try:
[txtFactClients] <>"0"
as your criteria.
-Ed
"Darryl Kerkeslager" <Ke*********@comcast.net> wrote in message
news:5v********************@comcast.com... Tony,
Try this before you do anything else: Look at your query in SQL view. The Query By Design in Access allows you to switch easily between SQL, Design and Datasheet view. Put it to it's full use. You can do anything in SQL view that you can do in Design View, and vice-versa (although some things are easier to do in one than the other).
If you can't work out how to do something, switch to SQL View, copy the SQL to the ng, and say exactly the results that you want. When you get your answer, copy the SQL back to a new query in SQL View. Then switch back to Design View if you want. IMHO, switching back and forth between the two is one of the best ways to learn. Not that the SQL that Access generates is perfect, but it works.
Darryl Kerkeslager
"Tony Williams" <tw@tcpinvalid.com> wrote in message news:cs**********@titan.btinternet.com... I have a query that I want to count the number of records where the value of a field "txtFactClients" is not 0. I have set up an expression "CountFC: txtFactClients" with Count selected in the Total line and [txtFactClients]>0 in the criteria line but when I run the query it counts every record whether or not it is 0. I've looked at previous post but they all seem to involve SQL, is there a way of doing this in the design mode of a query? TIA Tony
txtFactClients is probably a TEXT field and as such has string values, NOT
NUMBERS.
Try:
[txtFactClients] <>"0"
as your criteria.
-Ed
"Tony Williams" <tw@tcpinvalid.com> wrote in message
news:cs**********@titan.btinternet.com... I have a query that I want to count the number of records where the value of a field "txtFactClients" is not 0. I have set up an expression "CountFC: txtFactClients" with Count selected in the Total line and [txtFactClients]>0 in the criteria line but when I run the query it counts every record whether or not it is 0. I've looked at previous post but they all seem to involve SQL, is there a way of doing this in the design mode of a query? TIA Tony
Mike wrote: You need to remove [txtFactClients]>0 from the criteria line of your field "CountFC:txtFactClients" and add the field txtFactClients, choosing 'where' in the total line and >0 in the criteria line.
Mike
That should work. Or enter
TRUE
in the criteria for the expression
[txtFactClients]>0
While I fully agree with your advice to post the SQL of any problematic
query, I'd take a little issue with your "vice-versa" below.
I've had a number of times when I could manipulate joins in SQL view in ways
the Design View couldn't handle.
For example, suppose one table has a text field, and I want to link it to an
Integer field in another table. (Just for the sake of argument, let's say
these tables are linked from other sources, so I can't change the layout).
I can go into SQL View and write
SELECT * FROM Table1 INNER JOIN Table2 on
Table1.MyField=CStr(Table2.MyField)
This works great in SQL view, but refuses to display in Design View.
- Turtle
"Darryl Kerkeslager" <Ke*********@comcast.net> wrote in message
news:5v********************@comcast.com... Tony,
Try this before you do anything else: Look at your query in SQL view.
The Query By Design in Access allows you to switch easily between SQL, Design and Datasheet view. Put it to it's full use. You can do anything in SQL view that you can do in Design View, and vice-versa (although some things are easier to do in one than the other).
As well, you cannot do UNION queries in Design View
--
Doug Steele, Microsoft Access MVP http://I.Am/DougSteele
(no e-mails, please!)
"MacDermott" <ma********@nospam.com> wrote in message
news:xs****************@newsread2.news.atl.earthli nk.net... While I fully agree with your advice to post the SQL of any problematic query, I'd take a little issue with your "vice-versa" below.
I've had a number of times when I could manipulate joins in SQL view in ways the Design View couldn't handle.
For example, suppose one table has a text field, and I want to link it to an Integer field in another table. (Just for the sake of argument, let's say these tables are linked from other sources, so I can't change the layout). I can go into SQL View and write SELECT * FROM Table1 INNER JOIN Table2 on Table1.MyField=CStr(Table2.MyField)
This works great in SQL view, but refuses to display in Design View.
- Turtle
"Darryl Kerkeslager" <Ke*********@comcast.net> wrote in message news:5v********************@comcast.com... Tony,
Try this before you do anything else: Look at your query in SQL view. The Query By Design in Access allows you to switch easily between SQL, Design and Datasheet view. Put it to it's full use. You can do anything in SQL view that you can do in Design View, and vice-versa (although some things are easier to do in one than the other).
Both points well taken :)
I over-reached with "anything".
Darryl Kerekslager
"Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_canada.com> wrote As well, you cannot do UNION queries in Design View "MacDermott" <ma********@nospam.com> wrote
While I fully agree with your advice to post the SQL of any problematic query, I'd take a little issue with your "vice-versa" below.
I've had a number of times when I could manipulate joins in SQL view in ways the Design View couldn't handle.
For example, suppose one table has a text field, and I want to link it
to an Integer field in another table. (Just for the sake of argument, let's
say these tables are linked from other sources, so I can't change the
layout). I can go into SQL View and write SELECT * FROM Table1 INNER JOIN Table2 on Table1.MyField=CStr(Table2.MyField)
This works great in SQL view, but refuses to display in Design View.
"MacDermott" <ma********@nospam.com> wrote in message
news:xs****************@newsread2.news.atl.earthli nk.net... While I fully agree with your advice to post the SQL of any problematic query, I'd take a little issue with your "vice-versa" below.
I've had a number of times when I could manipulate joins in SQL view in ways the Design View couldn't handle.
For example, suppose one table has a text field, and I want to link it to an Integer field in another table. (Just for the sake of argument, let's say these tables are linked from other sources, so I can't change the layout). I can go into SQL View and write SELECT * FROM Table1 INNER JOIN Table2 on Table1.MyField=CStr(Table2.MyField)
This works great in SQL view, but refuses to display in Design View.
- Turtle
This is also true for non-visible SQL such as the following:
"Ela Bielska" <e@b.com> wrote This is also true for non-visible SQL such as the following:
Well, the SQL you "posted" is certainly non-visible.
Was your post design view or SQL view :)
Darryl Kerkeslager
Visible=False
"David Schofield" <d.***************@blueyonder.co.uk> wrote in message
news:41ea5e19.60685481@localhost...
Thanks Mike Ill try both of those
Tony
"Salad" <oi*@vinegar.com> wrote in message
news:a7*****************@newsread3.news.pas.earthl ink.net... Mike wrote:
You need to remove [txtFactClients]>0 from the criteria line of your field "CountFC:txtFactClients" and add the field txtFactClients, choosing 'where' in the total line and >0 in the criteria line.
Mike That should work. Or enter TRUE in the criteria for the expression [txtFactClients]>0 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: C White |
last post by:
A little while back I had a question about counting records and my
example was something like this:
in my database table i have the following records
john
ed
john
rick
tom
|
by: N. Graves |
last post by:
I have a table with records of games played with a field for players
name and another fields is a "WinorLose". One player may play several
games to complete a match. I want my report to tell me...
|
by: mjobrien |
last post by:
Thanks for the hint Allen (see below). But I am already doing that
count as total records read (5)in the report footer. That count is
unduplicated for the record not for the field - student ID as...
|
by: chrisc |
last post by:
Hello,
Hope this is the right place for this...
I am creating a testing database for components as they come off a
production line.
My reports need to select faults that are found, as well...
|
by: ChadDiesel |
last post by:
I appreciate the help on this group. I know I've posted a lot here the last
couple of weeks, but I was thrown into a database project at my work with
very little Access experience. No other...
|
by: johnds |
last post by:
This is my third question about eliminating accounting entries in a
clinical database, yet retaining the valid record. Latest wrinkle is
being able to sum the visits to the doctor, and the units of...
|
by: Viktor |
last post by:
I have a problem with counting empty fields in table.
For example: I have the field in which i coulld write several solutions.
"done", "not done", "send", "not send" etc.
In report i want to...
|
by: Chia Lee Lee |
last post by:
Hello…
I have problem when counting the number of records, which is based on the start date and end date.
I have tried to use message box to prompt the result, but the result given is...
|
by: mwang |
last post by:
I have sql like this:
select count(*) from TRANSACTION transaction0_ where transaction0_.CREATED > sysdate - 10 and exists (select lineItem.TRANSACTION_ID from LINEITEM lineItem where...
|
by: crassostrea |
last post by:
Hello and Happy New Year,
I have two tables in Access 2003 (Windows XP) with similar, but different, information. We’ll call them table A and table B. I want to count the number of records in...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
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...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
| |