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 / Forms Programming / August 2005

Tip: Looking for answers? Try searching our database.

Sort-of a sorting problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
John D - 10 Aug 2005 21:46 GMT
Hi there,

In a fix here with sorting.  A series of tasks for a project i'm working on
are grouped using outline heirarcharchal format (i.i 1.1, 1.1.1, 1.2.2.,
1.2.3.2.1, etc.).  Now, there are 5 levels of these heirarchies.  The lowest
level (x.x.x.x.x) designates a particular ask.  Each level above, is a
summary of the levels below that one.  So, for instance, 1.1.2.1 would be a
summary of 1.1.2.1.1, 1.1.2.1.2, 1.1.2.1.3, etc.

What I need to do is the following:
1.  Sort these into a list with proper outline format:

1.
1.1
1.1.2.1
1.1.2.1.1
1.1.2.1.2
1.2
1.2.1.2
...

2.  I need to find a way to sum each lower level into a successive level (ie
summarixe all 1.1.2.1.x iinto 1.1.2.1) up to the top level.  

Problems:
- Each of the lower level tasks is an aggregate sum already involving
several tables, subcalculation for each record, and summation of that sum
(per lowest level).  So direct summ will not work (cannot do aggregates
within others).

- The hierarchy:  using a text string would not sort when a level number is
2-digit.  (ie 1.10 and 1.2 will sort to 1.10 first then 1.2 (not 1.2 then
1.10)).  Separate fields could be used for each heirarchy level
(hn1.hn2.hn3.hn4.hn5), but this will be extremely tedious.  

- Also, the heirarchy numbers are not hard-coded, they are to be entered by
the user.

Any advice here?  This one's got me pulling out hair.. almost.  

- How does one sum when essentially im performing several nested iteretions?
Is creating several Action Queries that create new tables, then requery the
answer?

- How can one sort by numbers properly using a str variable?  Like operator
might work, but can someone please give help with this?  

Thanks in advace
JD
Marshall Barton - 10 Aug 2005 22:32 GMT
>In a fix here with sorting.  A series of tasks for a project i'm working on
>are grouped using outline heirarcharchal format (i.i 1.1, 1.1.1, 1.2.2.,
[quoted text clipped - 40 lines]
>- How can one sort by numbers properly using a str variable?  Like operator
>might work, but can someone please give help with this?  

I've always done this sort of thing by converting the user
entered data to a canonical form.  If all of the values are
of the form 001.010.001.002.001 (i.e fixed length parts with
leading zeros), then the normal sorting/grouping operations
will work on these strings.

Actually, space characters would be better than zeros if you
were to do this at data entry time,  Since space is not one
of the possible characters in the values, it would be easy
to remove them for display using the Replace funtion.

The values can be converted to the standardized form using a
custom function that you can put together using a loop and
the built in functions InStr and Mid.

I don't understand in what context you need to do the totals
calculations, so all I can say at this point is that the
standard aggegate functions will do this in each level's
group header/footer in a report.

Signature

Marsh
MVP [MS Access]

Ronald Roberts - 10 Aug 2005 23:06 GMT
I have an application that uses a numbering system like yours.
I setup 5 integer fields. This makes it easy for sort and grouping
totals. Then use a format or concatenation to put the number back
together.

Ron

> Hi there,
>
[quoted text clipped - 45 lines]
> Thanks in advace
> JD
 
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



©2008 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.