Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi !!! It should be quite easy,

Status
Not open for further replies.

zrzr

Programmer
May 22, 2003
83
FR
Hi !!!

It should be quite easy, but I am working on it since more than an hour and I feel very ...

I have a table with two columns (let's say c1 and c2)
Datas are sorted by the first column (c1)

Does anyone no a way to set the sort by c2 using VBA ?

 
Hi,
Are you talking about sorting from within a form or report? If so, then you should set the recordsource to be based on a query, and inside the query it is very easy to set the sort selection for any field(s) to ascending or descending.

HTH, [pc2]
Randy Smith
California Teachers Association
 
No, I want to change the order on the table.

I have a table with tons of entries, and I need to open the form based on this table many times. So, if I use a query, the query is called each time, and it's very very slow !!!!

So I think if I sort the table instead of using a query, the work wioll already be done for the next time !!

(I can't do it manually cause I have another form using the other sorting, so I really want to sort my table with VBA code)

So, any idea ?
 
Hi,
Go to Tables, then select Design. Did you set the sort field to Primary Key, and the Indexed property of the field to Yes?
If you have done all this, then is there any way to move old records to an archive table?
You also need to consider the processor speed of the pc, the amount of available memory, and the number of other applications running at that time.

HTH, [pc2]
Randy Smith
California Teachers Association
 
IT WORKS

Finally, I found the solution :

in VBA code, I put :

CurrentDb.Tabledef("tablename").Properties("OrderBy").Value = "tablename.c1, tablename.c2"

Thank for trying to help me.
I know the speed of the operation depends on my computer.
Using this method, the work is not more fast, but it is done very less frequently.

So, if anyone has a better idea to set it faster ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top