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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sort by date

Status
Not open for further replies.

Morc

Technical User
Jul 6, 2003
7
GB
I have a database in Access2000 which has a table of repair details for PCs. The database is sorted by Serial Number and then by date. I view the details from within my VB6 application by searching on the Serial Number but the records are not in date order, even though they are sorted in the right order within the original databse. Any ideas on how to do this? I've tried refreshing the databar but no joy.
 
Hi Morc,

What exactly do you mean when you say The database is sorted by Serial Number and then by date.?

Is your table indexed on these fields? Or have you just sorted a view of it in Access? Your view from your application is independent of any view within Access (which is really just another application viewing the underlying data).

You should put an ORDER BY clause into your SQL statement in your application in order to ensure the records come in the order you want them. If you don't you will get your records in primary key sequence, but even if that's what you want it is good practice to explicitly state it to maintain independence from the physical structure.

Enjoy,
Tony
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top