PC Review


Reply
Thread Tools Rate Thread

Parameter query. I need only the numerical part of a parameter.

 
 
Frank Martin
Guest
Posts: n/a
 
      2nd Dec 2005
I have to filter records from units of Kg, L, 5L, 5Kg, 10L, 10Kg, 200L,
200Kg etc.

But the numerical parts will be good enough, and shorten the list box.

How can I designate as paramers only the numerical part of the unit and
ignore the rest?


Please help, Frank


 
Reply With Quote
 
 
 
 
Allen Browne
Guest
Posts: n/a
 
      2nd Dec 2005
In the WHERE clause of your query (SQL View on View menu), you could use:
Val([YourFieldName]) = [How many?]
where "YourFieldName" represents the name of your field, and "How many?" is
the name of the parameter.

But the best solution would be to use two different fields: one for Quantity
(Number type field), and one for the unit of measurement (Text type field,
probably linked to a lookup table of valid unit names.) Advantages:
- Simplicity
- Performance
- Integrity (meaningful units only)
- Sorting, comparsion, and range-checking will be correct.
- Ability to convert from one unit type to another (e.g. grams <-> kilos or
pounds.)
- Ability to specify a default unit of measurement for each product, or
pricings per unit of measure.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Frank Martin" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>I have to filter records from units of Kg, L, 5L, 5Kg, 10L, 10Kg, 200L,
>200Kg etc.
>
> But the numerical parts will be good enough, and shorten the list box.
>
> How can I designate as paramers only the numerical part of the unit and
> ignore the rest?



 
Reply With Quote
 
 
 
 
Frank Martin
Guest
Posts: n/a
 
      2nd Dec 2005
Thank you. In the long term I will have to redesign the "tblProducts" so as
to split the value from the units, but it will be a daunting task since many
charts and queries use the existing arrangement.
Regards,Frank


"Allen Browne" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> In the WHERE clause of your query (SQL View on View menu), you could use:
> Val([YourFieldName]) = [How many?]
> where "YourFieldName" represents the name of your field, and "How many?"
> is the name of the parameter.
>
> But the best solution would be to use two different fields: one for
> Quantity (Number type field), and one for the unit of measurement (Text
> type field, probably linked to a lookup table of valid unit names.)
> Advantages:
> - Simplicity
> - Performance
> - Integrity (meaningful units only)
> - Sorting, comparsion, and range-checking will be correct.
> - Ability to convert from one unit type to another (e.g. grams <-> kilos
> or pounds.)
> - Ability to specify a default unit of measurement for each product, or
> pricings per unit of measure.
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia.
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "Frank Martin" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>>I have to filter records from units of Kg, L, 5L, 5Kg, 10L, 10Kg, 200L,
>>200Kg etc.
>>
>> But the numerical parts will be good enough, and shorten the list box.
>>
>> How can I designate as paramers only the numerical part of the unit and
>> ignore the rest?

>
>



 
Reply With Quote
 
John Spencer
Guest
Posts: n/a
 
      2nd Dec 2005
Use the Val function to get the number part

SELECT Distinct Val(Units) as UnitNum
FROM TheTable

In the query grid:
Field: UnitNum: Val(Units)
"Frank Martin" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>I have to filter records from units of Kg, L, 5L, 5Kg, 10L, 10Kg, 200L,
>200Kg etc.
>
> But the numerical parts will be good enough, and shorten the list box.
>
> How can I designate as paramers only the numerical part of the unit and
> ignore the rest?
>
>
> Please help, Frank
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Would like to learn how to Alpha numerical data entry numerical =?Utf-8?B?VG8gZ2FpbiB0aGUgbnVtYmVycyBmYXN0ZXI=?= Microsoft Access Getting Started 2 6th Nov 2012 11:03 AM
How do I resort numerical info into numerical order Liz M Microsoft Excel Worksheet Functions 1 19th May 2010 12:09 PM
error STOP:0x0000007B (parameter, parameter, parameter, parameter) robert35 Microsoft Access Getting Started 1 15th Dec 2004 04:28 PM
Trying to have this code generate only a numerical value list by rows: 1, 2, 3, ... 10, 11 John Tudor Microsoft Excel Discussion 1 20th May 2004 12:54 AM
Need to remove the integer part and keep the fractional part of a double or decimal Michael Søndergaard Microsoft C# .NET 5 14th May 2004 02:19 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:07 PM.