|
-
Jul 4th, 2000, 01:04 PM
#1
Thread Starter
Hyperactive Member
I am STUMPED. Can someone please tell me how you would sort an access table through code. I have tried using the ORDER BY, but either I am not using it correctly, or it only works with queries, because it is not doing the job.
Thanks,
-
Jul 4th, 2000, 01:12 PM
#2
Lively Member
ORDER BY should work, can you give me the SQL statement?
Roger
-
Jul 4th, 2000, 01:34 PM
#3
Thread Starter
Hyperactive Member
I tried using:
Code:
cmdtext = "SELECT surl,ptitle,stitle,sbib,serror,sid FROM temptable ORDER BY serror DESC;"
'connect to the database and retrieve the code
Set adoCon = CreateObject("ADODB.Connection")
adoCon.Open gblConnectString
Set adoCmd = CreateObject("ADODB.Command")
adoCmd.ActiveConnection = adoCon
adoCmd.CommandText = cmdtext
adoCmd.Execute
-
Jul 4th, 2000, 01:42 PM
#4
Addicted Member
That would sort your "recordset", that would not sort the Access table.
-
Jul 4th, 2000, 01:59 PM
#5
Lively Member
exactly, try:
Code:
cmdtext = "SELECT surl,ptitle,stitle,sbib,serror,sid FROM temptable ORDER BY serror DESC;"
dim adoRec as ADODB.Recordset
'connect to the database and retrieve the code
Set adoCon = CreateObject("ADODB.Connection")
adoCon.Open gblConnectString
Set adoCmd = CreateObject("ADODB.Command")
adoCmd.ActiveConnection = adoCon
adoCmd.CommandText = cmdtext
set adoRec = adoCmd.Execute
do while not adoRec.eof
debug.print adoRec.Fields("serror").value
adoRec.MoveNext
loop
serror is printed sorted in descending order
Roger
-
Jul 4th, 2000, 06:39 PM
#6
Thread Starter
Hyperactive Member
Thanks,
Works exactly like you said.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|