Question : Syntax error (missing operator) in query expression

I receive the following error message when I attempt to run a query from the search page.

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'gendate = #7/23/2010# ORDERBY boss DESC, employee ASC'.

If I remove the end of the statement (ORDERBY boss DESC, employee ASC), I receive results. But I want to sort the records.  

Please advise a possible solution.  Thank you.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = "Driver={Microsoft Access Driver (*.mdb)};DBQ=c:\inetpub\wwwroot\statusreports\db\status.mdb"

dim Office
Office="employee = '"&Request.Form("employee")&"' and "

if (Request.Form("employee")="All") Then
	Office=""
end if

Recordset1.Source = "SELECT *  FROM JAX  WHERE "&Office&" gendate = #"&Request.Form("gendate")&"# ORDERBY boss DESC, employee ASC"

Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>

Answer : Syntax error (missing operator) in query expression

Hi,

I believe the correct statement is ORDER BY, not ORDERBY in your query.
Other than this, it looks fine.

Regards.
Random Solutions  
 
programming4us programming4us