I need help with VBA.
I create a temp table to keep data for tranfering file from Excel. Sometimes
I have found unsorted data in the table, but always sorted.
All above I use VBA, so how can I sort data in the table? I need to use this
temp table to be a source table, before I transfer the data by using INSERT
query to other tables in the same access file.
Vincent Johns - 30 Mar 2006 00:15 GMT
Some of what you say seems inconsistent (for example, "I have found
unsorted data" doesn't match "always sorted"), but if I understand you
correctly, you don't need to use VBA. Just define a Query based on your
linked Table. For example, if the linked Table is [YourTable], you
could use
SELECT YourTable.*
FROM YourTable
ORDER BY YourTable.ImportantField;
and use this Query as your dataset, instead of the Table. You won't be
able to edit the results, but otherwise it will act a lot like a sorted
Table.
-- Vincent Johns <vjonhs@alumni.caltech.edu>
Please feel free to quote anything I say here.
> I need help with VBA.
> I create a temp table to keep data for tranfering file from Excel. Sometimes
> I have found unsorted data in the table, but always sorted.
> All above I use VBA, so how can I sort data in the table? I need to use this
> temp table to be a source table, before I transfer the data by using INSERT
> query to other tables in the same access file.
John Vinson - 30 Mar 2006 00:46 GMT
>I need help with VBA.
>I create a temp table to keep data for tranfering file from Excel. Sometimes
>I have found unsorted data in the table, but always sorted.
>All above I use VBA, so how can I sort data in the table? I need to use this
>temp table to be a source table, before I transfer the data by using INSERT
>query to other tables in the same access file.
You don't sort data in Tables. A Table should be viewed as an
unordered "bucket" of data.
You can use a Query with an Order By clause (select Ascending or
Descending on the sort row in the query grid, if you're using the grid
rather than the SQL window). That Query can then be used for reports,
forms, export to Excel, or whatever - it is not necessary to do
anything to the Table since you can do it all using the Query.
John W. Vinson[MVP]