Wrong sort order of report's details section

D

dsjohn_242

Hello all,
I need your help.
I am running MS Access 2000.

I have a Purchase Order form that has an Order Details subform where the
user enters line items for the order. Each line item is a seperate record in
the subform, which is is Datasheet view, that is associated with the main
order. There is no sort order of the subform. The order of the records in
the subform remain in the same order that the user entered them in and they
are not re-sorted at any time.

Now my problem is that when the reoport is generated for the order - it does
not inheret the same sort order as in the Order form's subform.

I want the details section sort order of my report to match the sort order of the records entered in the Order form's subform.

The sort order of the details section of the report are actually in reverse
order compared to the form's subform sort order.


Can you help ?
 
A

Allen Browne

Your Order Details table has a primary key?

Open the report in design view, and nominate this field in the Sorting And
Grouping box (View menu).

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

dsjohn_242 said:
Hello all,
I need your help.
I am running MS Access 2000.

I have a Purchase Order form that has an Order Details subform where the
user enters line items for the order. Each line item is a seperate record in
the subform, which is is Datasheet view, that is associated with the main
order. There is no sort order of the subform. The order of the records in
the subform remain in the same order that the user entered them in and they
are not re-sorted at any time.

Now my problem is that when the reoport is generated for the order - it does
not inheret the same sort order as in the Order form's subform.

I want the details section sort order of my report to match the sort order
of the records entered in the Order form's subform.
 
D

Dan St.John

Thanks for your quick response.

No. My Order Details table does not have a primary key.
..... and I believe it must stay this way because I do not want any sorting
taking place in my Order Details subform. Currently this is OK - it does not
do any sorting. My problem is that I want the details section of the
associated report to match the unsorted order on the Orders subform. What I
see it doing is that it takes the unsorted list of details and just
reverses, or flips, them.

D.
 
A

Allen Browne

The sorting on the report will always be unpredictable if you do not define
it.

Further, the sort order in your subform is also undefined. For example, it
may change after the database is compacted or rebuilt.

Either it is important enough for you to define the sort order, or else you
accept the fact that it is undefined.
 
D

dsjohn_242

Thanks.
The frustrating part of all is that I had this working at one point. My client inadvertantly destroyed their copy of the program and did not have a backup. Now I cannot find the latest version of my copy with the corrected sorting problem (shame on me). The requiremts are that the order in which the user enters the line items in the Order form's subform remain in that order (I have that part working OK) and that the details section of the associated report for that order match the Order form's subform order.
 
R

Rick Brandt

dsjohn_242 said:
Thanks.
The frustrating part of all is that I had this working at one point. My client
inadvertantly destroyed their copy of the program and did not have a backup. Now
I cannot find the latest version of my copy with the corrected sorting problem
(shame on me). The requiremts are that the order in which the user enters the
line items in the Order form's subform remain in that order (I have that part
working OK) and that the details section of the associated report for that order
match the Order form's subform order.

Then you need a sequential number or timestamp field that you can sort on.
There is no reliable "entry order" that you can pull up. When initially working
with a db there will appear to be a maintained Entry Order, but you cannot rely
on that over the long haul. As records are deleted and inserted and the file is
compacted that order will not be reliably maintained.
 
D

dsjohn_242

Rick,

You nailed it man !!
Now I remember that I had to add an autonumber field that I used to sort with.

Whew! What a relief. Everything looks good. Thanks a ton

Dan
 

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

Top