A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

using less than in criteria in select query



 
 
Thread Tools Display Modes
  #1  
Old February 26th, 2007, 08:48 PM posted to microsoft.public.access.queries
Anne
external usenet poster
 
Posts: 445
Default using less than in criteria in select query

Hello!
I have a table where I need to evaluate if one field (pre-weight) is less
than 0. I tried doing an select query where I said

"0.0"

in the criteria box but it would not select any records, even when I had set
one to be 0.000. Is there some other way to do this?
Thanks,
Anne
  #2  
Old February 26th, 2007, 08:50 PM posted to microsoft.public.access.queries
Michel Walsh
external usenet poster
 
Posts: 2,404
Default using less than in criteria in select query

I would have tried


0


without quotes. If Access added the quote, maybe the field, or the
expression, is a string, NOT a number, and "0" is like "s" somehow,
ie, you are asking for dictionary ordering, while it seems you seek a
numerical ordering. Can you check in design view, of the table, if the field
is numeric?



Hoping it may help,
Vanderghast, Access MVP


"Anne" wrote in message
...
Hello!
I have a table where I need to evaluate if one field (pre-weight) is less
than 0. I tried doing an select query where I said

"0.0"

in the criteria box but it would not select any records, even when I had
set
one to be 0.000. Is there some other way to do this?
Thanks,
Anne



  #3  
Old February 26th, 2007, 08:53 PM posted to microsoft.public.access.queries
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default using less than in criteria in select query

If you use "0.0" then it is looking for text - not a number.

Try using 0 without the quotes.
--
KARL DEWEY
Build a little - Test a little


"Anne" wrote:

Hello!
I have a table where I need to evaluate if one field (pre-weight) is less
than 0. I tried doing an select query where I said

"0.0"

in the criteria box but it would not select any records, even when I had set
one to be 0.000. Is there some other way to do this?
Thanks,
Anne

  #4  
Old February 26th, 2007, 09:00 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 7,815
Default using less than in criteria in select query

First, preWeight should be a number field.

If that is case the criteria should be 0. OR perhaps it should be = 0
(if you want zero weights in addition to those less than zero).

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

"Anne" wrote in message
...
Hello!
I have a table where I need to evaluate if one field (pre-weight) is less
than 0. I tried doing an select query where I said

"0.0"

in the criteria box but it would not select any records, even when I had
set
one to be 0.000. Is there some other way to do this?
Thanks,
Anne



  #5  
Old February 26th, 2007, 09:01 PM posted to microsoft.public.access.queries
Anne
external usenet poster
 
Posts: 445
Default using less than in criteria in select query

Thanks! I went in and made sure the field was a number field. I also made
sure it said 0. Then I ran the select query that says

Field:Preweight
Table:Table1
Sort:
Show: (checkbox is yes)
Criteria: 0

I also have it showing me the filter number if the preweight is less than
zero. But no filter numbers show up when I run the query.

Thanks,
Anne

"KARL DEWEY" wrote:

If you use "0.0" then it is looking for text - not a number.

Try using 0 without the quotes.
--
KARL DEWEY
Build a little - Test a little


"Anne" wrote:

Hello!
I have a table where I need to evaluate if one field (pre-weight) is less
than 0. I tried doing an select query where I said

"0.0"

in the criteria box but it would not select any records, even when I had set
one to be 0.000. Is there some other way to do this?
Thanks,
Anne

  #6  
Old February 26th, 2007, 09:13 PM posted to microsoft.public.access.queries
Anne
external usenet poster
 
Posts: 445
Default using less than in criteria in select query

Hello! I did so, and still don't get anything in the select query. I have
made sure my fields are number fields, too.
Anne

"Michel Walsh" wrote:

I would have tried


0


without quotes. If Access added the quote, maybe the field, or the
expression, is a string, NOT a number, and "0" is like "s" somehow,
ie, you are asking for dictionary ordering, while it seems you seek a
numerical ordering. Can you check in design view, of the table, if the field
is numeric?



Hoping it may help,
Vanderghast, Access MVP


"Anne" wrote in message
...
Hello!
I have a table where I need to evaluate if one field (pre-weight) is less
than 0. I tried doing an select query where I said

"0.0"

in the criteria box but it would not select any records, even when I had
set
one to be 0.000. Is there some other way to do this?
Thanks,
Anne




  #7  
Old February 26th, 2007, 09:14 PM posted to microsoft.public.access.queries
Anne
external usenet poster
 
Posts: 445
Default using less than in criteria in select query

I haven't tried = but I have tried with the fields being long integer
fields, and nothing happens. I'm stumped.
Anne

"John Spencer" wrote:

First, preWeight should be a number field.

If that is case the criteria should be 0. OR perhaps it should be = 0
(if you want zero weights in addition to those less than zero).

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

"Anne" wrote in message
...
Hello!
I have a table where I need to evaluate if one field (pre-weight) is less
than 0. I tried doing an select query where I said

"0.0"

in the criteria box but it would not select any records, even when I had
set
one to be 0.000. Is there some other way to do this?
Thanks,
Anne




  #8  
Old February 26th, 2007, 09:27 PM posted to microsoft.public.access.queries
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default using less than in criteria in select query

Do you get any results if you omit the criteria?
--
KARL DEWEY
Build a little - Test a little


"Anne" wrote:

Thanks! I went in and made sure the field was a number field. I also made
sure it said 0. Then I ran the select query that says

Field:Preweight
Table:Table1
Sort:
Show: (checkbox is yes)
Criteria: 0

I also have it showing me the filter number if the preweight is less than
zero. But no filter numbers show up when I run the query.

Thanks,
Anne

"KARL DEWEY" wrote:

If you use "0.0" then it is looking for text - not a number.

Try using 0 without the quotes.
--
KARL DEWEY
Build a little - Test a little


"Anne" wrote:

Hello!
I have a table where I need to evaluate if one field (pre-weight) is less
than 0. I tried doing an select query where I said

"0.0"

in the criteria box but it would not select any records, even when I had set
one to be 0.000. Is there some other way to do this?
Thanks,
Anne

  #9  
Old February 26th, 2007, 09:31 PM posted to microsoft.public.access.queries
Anne
external usenet poster
 
Posts: 445
Default using less than in criteria in select query

Oddly enough (or maybe not oddly), when I changed the number from long
integer to double, the query works. I wonder why? I have now experimented
with , , and = and =, and they return just fine. What was I doing wrong?

"KARL DEWEY" wrote:

Do you get any results if you omit the criteria?
--
KARL DEWEY
Build a little - Test a little


"Anne" wrote:

Thanks! I went in and made sure the field was a number field. I also made
sure it said 0. Then I ran the select query that says

Field:Preweight
Table:Table1
Sort:
Show: (checkbox is yes)
Criteria: 0

I also have it showing me the filter number if the preweight is less than
zero. But no filter numbers show up when I run the query.

Thanks,
Anne

"KARL DEWEY" wrote:

If you use "0.0" then it is looking for text - not a number.

Try using 0 without the quotes.
--
KARL DEWEY
Build a little - Test a little


"Anne" wrote:

Hello!
I have a table where I need to evaluate if one field (pre-weight) is less
than 0. I tried doing an select query where I said

"0.0"

in the criteria box but it would not select any records, even when I had set
one to be 0.000. Is there some other way to do this?
Thanks,
Anne

  #10  
Old February 27th, 2007, 03:17 AM posted to microsoft.public.access.queries
John W. Vinson
external usenet poster
 
Posts: 18,261
Default using less than in criteria in select query

On Mon, 26 Feb 2007 13:14:15 -0800, Anne
wrote:

I haven't tried = but I have tried with the fields being long integer
fields, and nothing happens. I'm stumped.


Do you have records in the table with values of preweight such as -1,
-11, -8? They should show up with a criterion of 0. Zero is, of
course, NOT less than zero, so zero values won't show up; similarly,
NULL (missing, unspecified) values are not less than zero (or greater
than zero, or unequal to zero, or ANY other comparison). The only
criterion which will find records with a NULL preweight is

IS NULL

so perhaps you could try

= 0 OR IS NULL


John W. Vinson [MVP]
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:40 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.