Skip to main content
Known Participant
July 6, 2007
Question

Recordset Help

Hi

On my access database i created a query, i then open dreamweaver and create a recordset based on that query.

Basically all i am doing is pulling data from two tables in the query, if i test the recordset all works fine, as soon as i add a statement saying only return results that are equal to MMCParam which is a form input field on the page, i get the error

Syntax error in query expression, any idears why this is.

I have tested the query on a recordset just pulling from one table and all works fine it just seems to happen when i build the recorset on the query.


Please help

John
This topic is closed to new replies. Start a new post to keep the conversation going.

2 replies

Inspiring
July 7, 2007
Please paste the code for the Recordset.


"pepps" <webforumsuser@macromedia.com> wrote in message
news:f6lo2o$o2i$1@forums.macromedia.com...
> Hi
>
> On my access database i created a query, i then open dreamweaver and
> create a
> recordset based on that query.
>
> Basically all i am doing is pulling data from two tables in the query, if
> i
> test the recordset all works fine, as soon as i add a statement saying
> only
> return results that are equal to MMCParam which is a form input field on
> the
> page, i get the error
>
> Syntax error in query expression, any idears why this is.
>
> I have tested the query on a recordset just pulling from one table and all
> works fine it just seems to happen when i build the recorset on the query.
>
>
> Please help
>
> John
>


Translate
peppsAuthor
Known Participant
July 9, 2007
Dim Recordset1__MMColParam
Recordset1__MMColParam = "advanced"
If (Request.Form("search") <> "") Then
Recordset1__MMColParam = Request.Form("search")
End If
%>
<%
Dim Recordset1
Dim Recordset1_cmd
Dim Recordset1_numRows

Set Recordset1_cmd = Server.CreateObject ("ADODB.Command")
Recordset1_cmd.ActiveConnection = MM_linkmicrotek_STRING
Recordset1_cmd.CommandText = "SELECT Supplier, Product_Type, Part_No, Frequency, Connector_Type, Average_Power_Handling, Switch_Type, Package, Gain, Pout, P1dB_Output, Output_IP3, Attenuation, Reverse_Voltage, name FROM Category WHERE Product_Type Like ?"
Recordset1_cmd.Prepared = true
Recordset1_cmd.Parameters.Append Recordset1_cmd.CreateParameter("param1", 5, 1, 1073741823, "%" + Recordset1__MMColParam + "%") ' adDouble

Set Recordset1 = Recordset1_cmd.Execute
Recordset1_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = -1
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows

This is the results page from a keyword search, the form variable is called search. As soon as i add the sql to say if like MMColParam thats when it does not work.

Please help

John
Translate