ORDER BY syntax problem

B

Bill

What's the syntax to specify ascending
sort when there are two sort fields to
effect?

I tried several different variations of
inserting the ASC keyword with TransDate
and TransSer, but was un-successful. E.g.,
[TransDate] ASC & """","""" & [TransSer];"
or
[TransDate] & """"ASC,"""" & [TransSer];"
do not work.

strSQL = "SELECT * FROM Transactions"
strSQL = strSQL & " WHERE [FolioID] = " & """" & ID & """"
strSQL = strSQL & " ORDER BY [TransDate] & """","""" & [TransSer];"
 
M

Marshall Barton

Bill said:
What's the syntax to specify ascending
sort when there are two sort fields to
effect?

I tried several different variations of
inserting the ASC keyword with TransDate
and TransSer, but was un-successful. E.g.,
[TransDate] ASC & """","""" & [TransSer];"
or
[TransDate] & """"ASC,"""" & [TransSer];"
do not work.

strSQL = "SELECT * FROM Transactions"
strSQL = strSQL & " WHERE [FolioID] = " & """" & ID & """"
strSQL = strSQL & " ORDER BY [TransDate] & """","""" & [TransSer];"

All you need if the field name list. Use DESC for
descending sorts, Asc for ascending, but ASC is the default
so you do not need to specify it. I have no idea why you
thinl you need to add a quote to the field's value, all it
does is make the sorting slower.

strSQL = strSQL & " ORDER BY TransDate, TransSer"
 
B

Bill

Thanks Marsh, I got it now.

Marshall Barton said:
Bill said:
What's the syntax to specify ascending
sort when there are two sort fields to
effect?

I tried several different variations of
inserting the ASC keyword with TransDate
and TransSer, but was un-successful. E.g.,
[TransDate] ASC & """","""" & [TransSer];"
or
[TransDate] & """"ASC,"""" & [TransSer];"
do not work.

strSQL = "SELECT * FROM Transactions"
strSQL = strSQL & " WHERE [FolioID] = " & """" & ID & """"
strSQL = strSQL & " ORDER BY [TransDate] & """","""" & [TransSer];"

All you need if the field name list. Use DESC for
descending sorts, Asc for ascending, but ASC is the default
so you do not need to specify it. I have no idea why you
thinl you need to add a quote to the field's value, all it
does is make the sorting slower.

strSQL = strSQL & " ORDER BY TransDate, TransSer"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top