Is there away to do this?

  • Thread starter ryan.fitzpatrick3
  • Start date
R

ryan.fitzpatrick3

In a query I have one field that would have a size of an object, i.e.
10 OZ, for weight of finished good product.

Now is there away to only take the numerical value of this and omit
the letters? I know left([fielda],2) works but some items are 1.25 oz,
10.145 lb, .134 fz, etc, all different whereas the left 2 wouldn't
work. Any help?

Ryan
 
D

Dirk Goldgar

In a query I have one field that would have a size of an object, i.e.
10 OZ, for weight of finished good product.

Now is there away to only take the numerical value of this and omit
the letters? I know left([fielda],2) works but some items are 1.25 oz,
10.145 lb, .134 fz, etc, all different whereas the left 2 wouldn't
work. Any help?


The Val() function will return the leading numeric value from a string. It
stops at the first character it can't interpret as a number. Check it out
in the VB help file. Note that some character combinations may be
interpreted as numeric that you wouldn't expect; for example, Val("4E5") =
400000, because Val interprets that as exponential notation.
 
R

ryan.fitzpatrick3

Good deal, now can I put this in the a new query field like
val([fielda])?


In a query I have one field that would have a size of an object, i.e.
10 OZ, for weight of finished good product.
Now is there away to only take the numerical value of this and omit
the letters? I know left([fielda],2) works but some items are 1.25 oz,
10.145 lb, .134 fz, etc, all different whereas the left 2 wouldn't
work. Any help?

The Val() function will return the leading numeric value from a string. It
stops at the first character it can't interpret as a number. Check it out
in the VB help file. Note that some character combinations may be
interpreted as numeric that you wouldn't expect; for example, Val("4E5") =
400000, because Val interprets that as exponential notation.
 
J

Jeff Boyce

If your "size" sometimes is in ounces, sometimes in pounds, sometimes in
(?)"fz"s, consider using TWO fields, one for the numeric value, the other
for the "unit of measure".

Regards

Jeff Boyce
Microsoft Office/Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top