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

Can't Use ORDER BY in RecordSources' SQL stmt?

Status
Not open for further replies.

JohnBates

MIS
Feb 27, 2000
1,995
US
I am using VB 6 and SQL Server 7

My app uses the DataGrid with an ADO Data Control.....

I want to use the following SQL command in the RecordSource's Command Text box:

Select * From DRScanner ORDER BY DRDateTime [DESC]

The app runs fine when I omit the ORDER BY clause.

But when I add ORDER BY DRDateTime [DESC] .....
get error: "incorrect syntax near the keyword 'DESC'

and when I use [DESCENDING] ...
get 'function DRDateTime not found'

I guess my question is Am I just using the wrong syntax
OR can I not do the sequencing in the Command Text box??

Thanks, John




 
its :

Select * From DRScanner ORDER BY DRDateTime DESC

and not :

Select * From DRScanner ORDER BY DRDateTime [DESC]
Eric De Decker
vbg.be@vbgroup.nl

License And Copy Protection AxtiveX.

Download Demo version on my Site:
 
just to clarify:
You looked up the syntax for a sql statement. In the part about ORDER BY it read ORDER BY [DESC] - The brackets [] mean it's optional. The brackets are not part of the syntax.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top