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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Group by the first X numbers i a query? 1

Status
Not open for further replies.

frontside

Technical User
Sep 26, 2002
85
SE
I have a datefield formatted as text that I would like to group by the first 6 numbers.

example

20040101
20040112
20040115
20040201

the result should be two groups with the first three in the first group and the last number in the second.

I want to do this in the query not in a report,

does anyone have any good ideas or suggestions?



Thanks, and let me know if you need any more information to help me out.


micke "sweden
 
What happens if you set the query to sort ascending on this field?
 
In design view in query builder: Type something like SortField:Cint(Left([fieldname],6)) in the field box. Choose Ascending/Descending in the sort box. Uncheck the "show " checkbox. Hope this helps!!
 
OOPS - forgot about the "grouping" thing; should still work...
 
it worked fine with Left([fieldname],)!!!

perfect

well worth a star!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top