filter question

  • Thread starter Thread starter matt shudy
  • Start date Start date
M

matt shudy

Hi,

If I use two filters

objRS.Filter="Location=" & Request.Form("Location")
objRS.Filter="Year=" & Request.Form("Year")

does this filter based on location and year or
does it filter by location and then does a new filter by
year and disreguards the first filter? if that is the
case how do i make the two filters into one? otherwise if
having two works... is there anything wrong with the code
that i have written, becasue i do get an error:

ADODB.Recordset error '800a0bb9'

Arguments are of the wrong type, are out of acceptable
range, or are in conflict with one another.


Thanks,
Matt
 
A little lesson in programming is needed here. Note that you assigned a
string to the Filter property of your RecordSet in your first statement.
Next you assigned another string to the same property. Now, if we
substituted "x" for "objRS.Filter" what would we get?

Dim x
x = "Location=" & Request.Form("Location")
x = "Location=" & Request.Form("Year")

How many values does x have? (Answer: 1 - the last value you assigned to it)

So, how many Filters does your RecordSet have?

Now, the error you mentioned is due to the fact that you didn't include any
punctuation in your Filter. You need to use the same rules as in a SQL
Statement. In other words, if you're comparing to a text field, use single
quotes. Etc.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Complex things are made up of
lots of simple things.
 
Back
Top