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 Mike Lewis 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 RecordSource's SQL Stmt?

Status
Not open for further replies.

JohnBates

MIS
Feb 27, 2000
1,995
0
0
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
 
Hi,

Use DESC without []. Your query should be:

Select * From DRScanner ORDER BY DRDateTime DESC

and it will work fine

Hope it will help...
 
Note.

the "[" & "]" are the delimiters for [Optional] elements of the syntax. Here, the [Desc] is optional to indicate "Descinding" as opposed to the default "ascending".


MichaelRed
redmsp@erols.com

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top