I’m using Access as a backend for an ASP page. I’m using saved queries.
The table looks like this:
UCall Zone Band
NF4L 2 B160
NF4L 5 B40
NF4L 7 NULL
AB2AB 5 B10
The query looks as follows:
Select COUNT(*) as BCnt
From tblScore
Where Band IS NOT NULL and UCall=[in_call];
The result should be a count of all rows for a given call where there is an entry for Band. The query run with NF4L as the parm should return 2.
The query works as expected in Access itself, but when the ASP page is run I get
"Syntax error (missing operator) in query expression 'Band IS NOT NULL and UCall=[in_call]'.
From the ASP page:
function GetBandTotals(in_call)
conn2.BandSummary in_call, BRS
GetBandTotals = BRS("BCnt")
end function
conn2 is an adodb connection
BRS is an adodb recordset
I’ve verified that in_call is getting there.
Bandis a reserved word, so enclose that name in square brackets.Also add a
PARAMETERSclause to inform the db engine to expect text type for thein_callparameter. I don’t know whether that will help, but it won’t hurt.