Skip to main content
Participating Frequently
October 28, 2009
Question

Syntax error (missing operator) in query expression

  • October 28, 2009
  • 2 replies
  • 633 views

Hello all,

I have two pages, one page inserts and passes variables to the other page. The other page, (troublesome page) I have the following code:

<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/connNewdatabase.asp" -->
<%
Dim svuserid
svuserid = "0"
if (Session("UserID") <> "") then svuserid = Session("UserID")
%>
<%
set rsClients = Server.CreateObject("ADODB.Recordset")
rsClients.ActiveConnection = MM_connNewdatabase_STRING
rsClients.Source = "SELECT *  FROM CLIENTSW WHERE CASENUM="& Replace(svuserid, "'", "''") & "Order by Casenum"
rsClients.CursorType = 0
rsClients.CursorLocation = 2
rsClients.LockType = 3
rsClients.Open()
rsClients_numRows = 0
%>

My insert page inserts correctly, but when I get to the second page I get the following error:

Microsoft JET Database Engine error '80040e14'

Syntax error (missing operator) in query expression 'CASENUM=09E-1006721Order by Casenum'.

/done3.asp, line 16

I can see by this statement that my variable, svuserid, is being passed correctly as the previous page inserted 09E-1006721 as the casenum. It is being stored in a field called casenum, it is of text type. I believe the problem is the "Order by Casenum". If I take the "Order By Casenum" out I get:

ADODB.Field error '800a0bcd'

Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

/done3.asp, line 34

How do you write the select statement above to read select everything out of clientsw where the casenum = svuserid, order by field casenum if the field casenum is a text field? I am probably missing something simple, but its got me stumped.

This topic has been closed for replies.

2 replies

David_Powers
Inspiring
October 29, 2009

Marking this thread as assumed answered.

poohgcAuthor
Participating Frequently
October 28, 2009

Disregard this post please.