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

Sort a subform/subreport

Status
Not open for further replies.

milte

Technical User
Jan 30, 2002
20
US
Hello,

I have a form with a subform. The subform is default as a datasheet. When I preview the the report of this form/subform, the records in the subreport are not in the same order as on the subform. I am not sorting or grouping by anything on the report, nor on the form.

Any ideas on why the data is not in the same order?

Thanks,
Mike
 
Probably because the form/subform's recordsource is different from report/subreport's recordsource.

HTH
[pipe]
Daniel Vlas
Systems Consultant
danvlas@yahoo.com
 
Mike,

Unless you explicitly sort your records, they will come up sorted in whatever way Access wants. If you want them both sorted the same way, you'll have to sort them.

Jeremy =============
Jeremy Wallace
Designing, Developing, and Deploying Access Databases Since 1995

Take a look at the Developer's section of the site for some helpful fundamentals.
 
Thanks for the reply.

The recordsource for both the subform and subreport is the same table.

I don't want any sort for the subreport. I just want the data displayed exactly the way it was entered in the subform.

Mike
 
Mike,

You'll have to add some field that records the order in which records were added to the subform and sort by that. It can be an autonumber field or a date field or a roll-your-own sequential field. But you have to have a field and sort by it. Otherwise, as I said, Access will sort it however it feels like it. Records are not stored in the order in which they're recorded.

Jeremy =============
Jeremy Wallace
Designing, Developing, and Deploying Access Databases Since 1995

Take a look at the Developer's section of the site for some helpful fundamentals.
 
Thanks, Jeremy.

I added an autonumber field to the table and set the subforms/subreports to sort on that field. Works like a charm. I really appreciate your help.

Mike
 
No problem. That's what the forum is for.

Jeremy =============
Jeremy Wallace
Designing, Developing, and Deploying Access Databases Since 1995

Take a look at the Developer's section of the site for some helpful fundamentals.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top