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

access query returns no data when order by used

Status
Not open for further replies.

BobWman

Programmer
Jan 7, 2002
169
US
I have a small lookup table, that looks like this:

ID Code Description Abbrev
----------- ---- --------------- -------
1 1 Bulk Bulk
2 2 Ring Ring
3 3 SPT SPT
5 4 Shelby Tube ST

I can write a query such as:

Select * From table

and 4 rows are returned. But if I sort on certain columns, no data is returned, and no error is encountered.

Select * From table Order By Description

returns no data. I can sort by ID or Code successfully, but when I use Description or Abbrev as my sort column, nothing is returned.

I have run Compact and Repair, which didn't help. Can anyone tell me what is happening?

Thanks
 
Select * From table Order By Description DESC

or

Select * From table Order By Description ASC

-VJ
 
This didn't fix the problem. However, I just noticed that all the records were removed during the Compact and Repair. So, the table actually is empty. It isn't empty in the original database.

I think I need to do some further analysis of the problem. I am creating the data in the table during a re-synchronization process with a SQL Server database using VB.Net. If there is a mismatch in the tables, I delete the Access table (Delete * From Table), then insert the records from SQL Server. Previously, during this process, I have seen some of the tables full of records that said "#DELETED". I didn't know how that happened, and if you look for "#DELETED" in help for Access, nothing is found. I removed all this data a few days ago.

Does any of this ring a bell with anyone?

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top