473,387 Members | 1,464 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Sorting a recordset?

MLH
In the code snippet below, MyMovies is a table of movie names.
First field is a unique long integer ID. Second field is text string
containing movie name. The second field's Indexed Property
setting is Yes (no duplicates).

I would like to open the dynaset sorted on the first field rather
than on the second field. First field is [MovieID]. Second field is
[MovieName]. Anyone know how to structure the DAO so the
table is opened sorted on the first field? Or, how to re-sort it after
the Recordset is already opened?

Dim MyDB As Database, MySet As Recordset
Set MyDB = DBEngine.Workspaces(0).Databases(0)
Set MySet = MyDB.OpenRecordset("MyMovies", DB_OPEN_DYNASET)
MySet.MoveLast
...
Nov 13 '05 #1
3 12082
"MLH" <CR**@NorthState.net> wrote in message
news:07********************************@4ax.com...
In the code snippet below, MyMovies is a table of movie names.
First field is a unique long integer ID. Second field is text string
containing movie name. The second field's Indexed Property
setting is Yes (no duplicates).

I would like to open the dynaset sorted on the first field rather
than on the second field. First field is [MovieID]. Second field is
[MovieName]. Anyone know how to structure the DAO so the
table is opened sorted on the first field? Or, how to re-sort it after
the Recordset is already opened?

Dim MyDB As Database, MySet As Recordset
Set MyDB = DBEngine.Workspaces(0).Databases(0)
Set MySet = MyDB.OpenRecordset("MyMovies", DB_OPEN_DYNASET)
MySet.MoveLast


Base the RecordSet on a SQL Statement instead if the raw table.

Dim MyDB As Database, MySet As Recordset
Set MyDB = DBEngine.Workspaces(0).Databases(0)
Set MySet = MyDB.OpenRecordset("SELECT * FROM MyMovies ORDER BY MovieID",
DB_OPEN_DYNASET)
MySet.MoveLast

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 13 '05 #2
MLH
Yes, I had considered that. But I wanted to do it at the table
level within DAO, if it could be done. A workaround that
accomplished the objective was to switch the order of the
two fields. Making [MovieName] the first field and making
its Indexed Property setting Yes No Duplicates did the
trick. But, do you know if there is a way to sort the
RecordSet after opening with DAO?

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxx

On Tue, 30 Nov 2004 21:35:21 -0600, "Rick Brandt"
<ri*********@hotmail.com> wrote:
"MLH" <CR**@NorthState.net> wrote in message
news:07********************************@4ax.com.. .
In the code snippet below, MyMovies is a table of movie names.
First field is a unique long integer ID. Second field is text string
containing movie name. The second field's Indexed Property
setting is Yes (no duplicates).

I would like to open the dynaset sorted on the first field rather
than on the second field. First field is [MovieID]. Second field is
[MovieName]. Anyone know how to structure the DAO so the
table is opened sorted on the first field? Or, how to re-sort it after
the Recordset is already opened?

Dim MyDB As Database, MySet As Recordset
Set MyDB = DBEngine.Workspaces(0).Databases(0)
Set MySet = MyDB.OpenRecordset("MyMovies", DB_OPEN_DYNASET)
MySet.MoveLast


Base the RecordSet on a SQL Statement instead if the raw table.

Dim MyDB As Database, MySet As Recordset
Set MyDB = DBEngine.Workspaces(0).Databases(0)
Set MySet = MyDB.OpenRecordset("SELECT * FROM MyMovies ORDER BY MovieID",
DB_OPEN_DYNASET)
MySet.MoveLast


Nov 13 '05 #3
"MLH" <CR**@NorthState.net> wrote in message
news:bl********************************@4ax.com...
Yes, I had considered that. But I wanted to do it at the table
level within DAO, [SNIP]


Please explain this. You do realize that when you open the RecordSet
directly on the tablename Jet is actually doing a "SELECT * FROM TabelName"
in the background don't you? By explicitly using a SQL statement yourself
you are simply adding the ability to filter and sort.
--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com

Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Travis Pupkin | last post by:
Hi, Can anyone point me to a good online tutorial (preferably for slow learners) about advanced handling of arrays, like re-sorting the data, etc.? Thanks.
12
by: CJM | last post by:
How can I dynamically sort the results from a Stored Procedure? Or more importantly, what is the fastest and most efficient way? I know I can do the sorting within the recordset in ASP, but AFAIK...
22
by: Gerry Abbott | last post by:
Hi all, I having some confusing effects with recordsets in a recent project. I created several recordsets, each set with the same number of records, and related with an index value. I create...
3
by: alex_peri | last post by:
Hello All, I am having problems with sorting a recordset by fields in Access. I have a table with three columns called ID, SNo and Time and would like to sort the records by Time. I would like to...
7
by: Geert Elias | last post by:
Hello all, When making a new table by running a make table query based on a table, the field I added a descending sort, is not always sorted correct. When I run the query 10 times, almost 7...
1
by: Marc | last post by:
From: Marc - view profile Date: Fri 15 Dec 2006 10:48 Email: "Marc" <marc_cro...@hotmail.com> Groups: microsoft.public.vb.general.discussion Not yet ratedRating: show options Reply |...
3
by: Jimmy | last post by:
Is there a way to sort/group a report based on the second column of a combo box, i.e. the text associated with the primary key number?
0
by: stainless | last post by:
Always have problems explaining issues on these forums but here goes (hope it makes some sense); I have created a recordset via a MapObjects Geodataset and SearchLayer function. The means by...
0
by: Yarik | last post by:
Hello, Here is a sample (and very simple) code that binds an Access 2003 form to a fabricated ADO recordset: ' Create recordset... Dim rs As ADODB.Recordset: Set rs = New ADODB.Recordset '...
2
by: Bob Laubla | last post by:
Hello I have a very complex maketable query with many records and involving multiple VB functions which call other functions. I need this table to be sorted by the first field. But no matter what...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.