preserve order of the query

Posted on 2012-09-14
Last Modified: 2012-09-25
Hi.  Is there any way to keep fields in the query in certain order?

Issue: I need to keep resultset of the query in order colA, colB, colC, colD, colE, colf

Although SQL view list above listed order, resultshet displays columns in changed order
cola, colb, cold, colF, colE, colc
Question by:maximyshka
    LVL 65

    Expert Comment

    by:Jim Horn
    >Although SQL view list above listed order, resultshet displays columns in changed order
    Show us.   Please copy-paste the query SQL, and a screen shot of the results, into this question.
    LVL 84
    What do you mean by "resultset"? Are you opening the query in the interface, or are you using it when opening a Recordset?

    If you're using a Recordset, then the only way to insure the order of your columns is to specify the columns:

    SELECT ColA, ColB, ColE, ColF, ColC FROM MyTable

    Instead of

    SELECT * FROM MyTable
    LVL 48

    Accepted Solution

    It is the property ColumnOrder of the fields that sets the order of the columns when you display a select Query.

    The fastest way to reset it is to copy and paste the SQL into a new query.


    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    The first two articles in this short series — Using a Criteria Form to Filter Records ( and Building a Custom Filter ( — discuss in some detail how a form can be…
    This isn't a frequent question on EE. I must have seen it three or four times (among several thousand questions). However, I use this trick quite often, most frequently as a delayed Current event. A form does not expose it's calculation dependenc…
    Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
    Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now