Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2004
    Location
    Sunnyvale, CA
    Posts
    14

    Question Unanswered: Query-based report not ordered properly

    I have a query that joins two tables, one with names and the other with addresses, with the resulting recordset ordered by zip code. When I run the query by itself, the results are indeed ordered by zip code. But when I create a report based on the query (to print mailing labels), the results are not ordered by zip. Can anyone think of any possible reason why the order would be different for the query and the report based on it?

    Thanks

  2. #2
    Join Date
    Apr 2004
    Posts
    130
    The Sort/Grouping of a report takes priority over the underlying query... if you have a sort OR grouping. Sometimes this is a pain.

    Winston

  3. #3
    Join Date
    Jan 2004
    Location
    Sunnyvale, CA
    Posts
    14
    Thanks for the advice. I set the sort parameters in the report, and it worked fine. One more question: is there any way to set the sort parameters programmatically? Sometimes I want to sort by zip code, but other times I want to sort by name. Or do I have to have a separate report for that?

    Marty

  4. #4
    Join Date
    Apr 2004
    Posts
    130
    Try real hard not to use a separate report. Makes maintenance a pain in the neck. The best way to do it is by not using the sort and grouping
    g of the report and use the vba of the report "OnOpen". Me. RecordSource = "qryXYZ"
    Doesn't work with grouping, only with basic reports. Probably a way to do groupings programatically, but I've never needed to.
    Winston

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •