467,119 Members | 1,015 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,119 developers. It's quick & easy.

To sort whole table according to a field in ascending order

sir,
i have a table named tblexam.
i want to sort the whole table records according to the field subcode in ascending order.

docmd.runsql "update tblexam order by subcode asc"
But it is showing syntax error.
please help me.
Apr 29 '07 #1
  • viewed: 3239
Share:
4 Replies
ADezii
Expert 8TB
sir,
i have a table named tblexam.
i want to sort the whole table records according to the field subcode in ascending order.

docmd.runsql "update tblexam order by subcode asc"
But it is showing syntax error.
please help me.
To simply View all Records in tblExam by [subcode] Ascending:
  1. Create a Query called qryExam with the following SQL:
    Expand|Select|Wrap|Line Numbers
    1. SELECT * FROM tblExam ORDER BY tblExam.subcode;
  2. Execute this single line of code to view the results.
    Expand|Select|Wrap|Line Numbers
    1. DoCmd.OpenQuery "qryExam", acViewNormal, acReadOnly
Apr 29 '07 #2
sir,
The query you had given is working It is giving result with the records in ascending order. i want to update my table tblexam.After running that query my table is not updated.
how to do this
please help me.
Apr 30 '07 #3
pks00
Expert 100+
Do you mean you want the records in your table sorted in that order?

Why would u want to do that, u simply need to write a query as already shown and that is it.
Apr 30 '07 #4
sir,
yes, i mean the table named tblexam records to be sorted in that order.
i need it because
in the table fields are sno,questionno,subcode,question,option1,option2,op tion3,option4,answer.
I have a form created using wizard from that tblexam.
In the form add,delete,...command buttons are there.
when i add a question related to subcode (say mat) that record has to go to the table after the subcode (mat) last record instead of the last record in the table.so i want to sort every time on basis of subcode the whole table when we add,delete records so that the records will be in ascending order on the basis of subcode.
Apr 30 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Deano | last post: by
1 post views Thread by deko | last post: by
7 posts views Thread by DC Gringo | last post: by
11 posts views Thread by Alan T | last post: by
9 posts views Thread by Troy | last post: by
3 posts views Thread by usaccess@gmail.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.