Solved

How do I get code to run through recordsets as they are shown?

Posted on 2014-10-06
4
204 Views
Last Modified: 2014-10-22
Firstly, I run an append query to a table.  The data is needing to be in order by Record Locator. The Record Locator Number is a specific column used to to group invoices together.

After the append query is completed and I open the table, the data is shown in the order I want to see it.

I then run the code to loop through all recordsets on that specific table.  However, instead of looping through the recordsets as they are shown the code loops through the recordsets by the order of another column in the table.

I need the loop to recognize the order according to the Record Locator and not the other column.

Help would greatly be appreciated.
0
Comment
Question by:Denise Knell
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 10

Expert Comment

by:Anthony Berenguel
ID: 40364021
Use the recordset.sort function to sort the recordset on the field and in the order you like.
0
 
LVL 10

Accepted Solution

by:
Anthony Berenguel earned 500 total points
ID: 40364032
for example
rstOriginal.Sort = "id asc" to sort the recordset on the field 'id' in ascending order

Open in new window

0
 
LVL 30

Expert Comment

by:hnasr
ID: 40364054
Try Anthony Berenguel's comment first.

"As they are shown"
Shown where? Displayed in form?

List the code to create the record set. The record set is created using the select statement with Order By phrase.
0
 
LVL 38

Expert Comment

by:PatHartman
ID: 40364954
Tables and queries are unordered sets.  If you want them presented in a particular order, you need to use a query with the Order By clause.  I never used the recordset.sort method but I would guess it to be less efficient than including the Order By clause in the query and letting the server do the sort.  It probably makes no difference if the BE is Jet or ACE but I prefer to use techniques that will work for a server-side database since most of my apps ultimately get "upsized".  If I always use good client/server techniques, I can do the upsizing in a couple of hours at most.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

717 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