MIN/MAX not working

J

jutlaux

I have a query that has a field that pulls out some data from another field
by the following statement

WIDTH:
Mid([PART_ID],InStr(1,[PART_ID],"W")+1,InStr(2,[PART_ID],"A")-InStr(1,[PART_ID],"W")-1)

This part works great.

The problem is that I now want to find the MIN & MAX of the WIDTH so I
created another query that has 2 fields 1)Total: MAX 2) Total: MIN.

The problem is when I run this query it doesn't give me the actually MIN and
MAX of the data. It gives me numbers but they are not correct. I know this
b/c if I export the original query that got me WIDTH to excel and find the
MIN & MAX on it I get the correct values. What am I doing wrong?
 
J

Jerry Whittle

That's because it's not returning numbers. Rather it's returning numerical
characters in a string. From Help: Mid Function Returns a Variant (String)
containing a specified number of characters from a string.

You need to wrap your code in something like CDbl to covert the strings to
numbers. The Val() function should work also.
 

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

Similar Threads


Top