Select A Numeric Range??

terbs

Registered User.
Local time
Tomorrow, 03:32
Joined
May 15, 2007
Messages
38
I have a table with a numeric primary key field. Is it possible to create a select statement which returns a list of the records with the same whole number??

E.g

144.2
144.4
144.5
144.7
144.8
144.9

I need this as the Rowsource for a combo-box. Are there wildcards that I could use??
 
If you make a calculated field in your query

YourNewFieldName:Fix([Thenumberfieldinquestion])

The new field will show the number to the left of the decimal point.

Left and Right functions could also be used since you have the decimal point as a reference point. Use "." in function
 
Thanks Mike works perfectly :)
 
Going on from there.... Can I create a Select statement which only returns a list of records that are xxx.0??

I.e exclude records that have .1, .2, .3, .4, .5, .6, .7, .8, .9

Thanks in advance
 
Terbs,

Another new field in your query:

NewField: Right(Format([YourField], "000000000.0"), 1)

And its Criteria in the section underneath:

<> "0"

Or, even easier, in the Criteria section of the query for your field:

= CLng([YourField])

either way will work.

Wayne
 
Wayne I found your method only removes the decimal point from [MyField]. It doesnt actually EXCLUDE the entire record.

What I need to create is a Select statement which only returns records WHERE decimal point = .0.

Not .1, .2, .3, .4, .5, .6, .7, .8, .9
 
Found the answer on anouther forum, but here it is incase someone else would like to know later on:

Put in the WHERE Criteria of your Select Statement.

INT(YourField)
 
Hi -

The Int() function merely returns the integer portion of a number, without regard as to whether there's a decimal remainder. From the debug window:

x = 99.2
? int(x)
99

What's needed is a boolean statement to determine if there's a decimal remainder, e.g.

? x/int(x) = 1
False

Here's what would be returned for a number without decimal remainder:

y = 99.0

? y/int(y) = 1
True

Bob
 

Users who are viewing this thread

Back
Top Bottom