sql_language thread: Problem using a string variable as the RecordSet.Filter criteria.
You problem is with the code not the filter ;)
try that
(you werent concatinating the Array value you was trying to filter it ;)
objRS.Filter =3D "LinkName =3D strName(0)" should be objRS.Filter =3D "
LinkName =3D " & strName(0) (I changed it for you below))
<%
Dim strConnect, strChoice, strName, objRS
=09
strConnect=3D"driver=3D{Microsoft Access Driver (*.mdb)};" & _
"dbq=3Dc:\InetPub\wwwroot\users\d229850\favlinks6.mdb;"
Set objRS =3D server.CreateObject("ADODB.Recordset")
'Get the users selection from the form
strChoice =3D Request.Form("link")
'User selection is in form of LinkName;LinkURL so I'm splitting
'strChoice at the semi-colon into an array of strName(0) and
'strName(1). I would like to use strName(0) as my filter
'criteria.
strName =3D split(strChoice,";")
objRS.Open "Links", strConnect, adOpenDynamic,_
adLockOptimistic, adCmdTable
=09
'The following statement creates an argument error
'Arguments are of the wrong type, are out of acceptable range,
'or are in conflict with one another.
objRS.Filter =3D "LinkName =3D " & strName(0)
On 12/4/2002 8:42 PM, major_paton@y... wrote:
>What is the proper method and syntax to use a string variable as the
>
>criteria for a RecordSet.Filter query? I'm obtaining a selection
>from a
>form and would like to use the users selection as the filter. Here
>is my
>current code with comments to explain what I'm trying to do:
>
><%
> Dim strConnect, strChoice, strName, objRS
>=09
> strConnect=3D"driver=3D{Microsoft Access Driver (*.mdb)};" & _
> "dbq=3Dc:\InetPub\wwwroot\users\d229850\favlinks6.mdb;"
> Set objRS =3D server.CreateObject("ADODB.Recordset")
>
> 'Get the users selection from the form
> strChoice =3D Request.Form("link")
>
> 'User selection is in form of LinkName;LinkURL so I'm splitting
> 'strChoice at the semi-colon into an array of strName(0) and
> 'strName(1). I would like to use strName(0) as my filter
> 'criteria.
> strName =3D split(strChoice,";")
>
>
> objRS.Open "Links", strConnect, adOpenDynamic,_
> adLockOptimistic, adCmdTable
> =09
> 'The following statement creates an argument error
> 'Arguments are of the wrong type, are out of acceptable range,
> 'or are in conflict with one another.
>
> objRS.Filter =3D "LinkName =3D strName(0)"
>
>Any help is greatly appreciated!! Thanks in advance.
>Major Paton
>to unsubscribe send a blank email to leave-sql_language-1856685N@p...
com.
>
>