Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

QUERY QUESTION 1

Status
Not open for further replies.

JENUTILITY

Technical User
Mar 19, 2001
2
US
I HAVE A QUESTION WITH A QUERY -
I MADE A QUERY TO FORMULATE A WEEK FOR MY DATES : WEEK:(FORMAT([DATE],"ww")) - THIS RETURNS A WEEK # FOR MY DATES, THIS WORKS OKAY
MY PROBLEM IS, WHEN I GET INTO MY NEXT QUERY I AM GROUPING ON WEEK # (IN ASCENDING ORDER) AND SUMMING A FEW OTHER FIELDS, THIS WORKS OKAY OTHER THAN MY WEEKS IN ORDER ARE SHOWING WEEK 10,11,9 ANY WAY I CHANGE IT THE WEEK 9 IS IN THE MIDDLE NOT THE FIRST RECORD? ANY HELP WOULD BE APPRECIATED. (THOSE ARE THE ONLY 3 WEEKS IN MY QUERY SO FAR)
THANK YOU
 
The query is treating the field week as a string, therefore it is comparing the first character in each of the fields and putting it in the order 1,1,9.

I would just concatenate a 0 onto strings that were of length one,

week: IIf((Len(Format([date],"ww"))=1),"0" & Format([date],"ww"),Format([date],"ww"))

but someone else might have a cleaner way of doing it. Mike Rohde
rohdem@marshallengines.com
 
Couldn't you use the CINT() function to convert it to a numeric, thus allowing the numbers to sort themselves?
Code:
:(CINT(FORMAT([DATE],"ww")))
Not sure if this is the best way or not... Terry M. Hoey
th3856@txmail.sbc.com
While I don't mind e-mail messages, please post all questions in these forums for the benefit of all members.
 
Yeah, that does make more sense, doesn't it. Just need to know the fuctions.:) Mike Rohde
rohdem@marshallengines.com
 
I also need to learn how to spell.:eek:) Mike Rohde
rohdem@marshallengines.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top