Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / April 2008

Tip: Looking for answers? Try searching our database.

MIN/MAX not working

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jutlaux - 23 Apr 2008 16:16 GMT
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?
Jerry Whittle - 23 Apr 2008 16:28 GMT
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.
Signature

Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.

> I have a query that has a field that pulls out some data from another field
> by the following statement
[quoted text clipped - 11 lines]
> 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?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.