Solved

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

Posted on 2014-10-06
4
174 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
  • 2
4 Comments
 
LVL 10

Expert Comment

by:Anthony Berenguel
Comment Utility
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
Comment Utility
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
Comment Utility
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 34

Expert Comment

by:PatHartman
Comment Utility
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

As with any other System Center product, the installation for the Authoring Tool can be quite a pain sometimes. This article serves to help you avoid making these mistakes and hopefully save you a ton of time on troubleshooting :)  Step 1: Make sur…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…

762 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

11 Experts available now in Live!

Get 1:1 Help Now