?
Solved

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

Posted on 2014-10-06
4
Medium Priority
?
211 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 1500 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

801 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