Home All Groups Group Topic Archive Search About

ADO Recordset Filter Problem

Author
20 Mar 2006 3:18 PM
george
I have a recordset with data that I want to filter.  I use the filter method
based my query and it filters the recordset.  However, my question is why
does it only display one row of data when the query should get multiple
records?

Thanks

Author
20 Mar 2006 4:43 PM
Alastair MacFarlane
George,

You would really need to give the group the filter statement and an
explanation of what type of data (with sample values) are being filitered.

Alastair MacFarlane

Show quoteHide quote
"george" wrote:

> I have a recordset with data that I want to filter.  I use the filter method
> based my query and it filters the recordset.  However, my question is why
> does it only display one row of data when the query should get multiple
> records?
>
> Thanks
>
>
>
Author
20 Mar 2006 4:46 PM
Bob Butler
"Alastair MacFarlane" <AlastairMacFarl***@discussions.microsoft.com> wrote
in message news:1CAB53FC-20C9-480D-A134-6B4C72F9DD4B@microsoft.com
>> I have a recordset with data that I want to filter.  I use the
>> filter method based my query and it filters the recordset.  However,
>> my question is why does it only display one row of data when the
>> query should get multiple records?
> You would really need to give the group the filter statement and an
> explanation of what type of data (with sample values) are being
> filitered.

And how you are displaying the results

--
Reply to the group so all can participate
VB.Net: "Fool me once..."
Author
20 Mar 2006 5:16 PM
george
Sorry about that.  Here is the code:

strPartNo = 'VR234234'
rsData.Filter = "fpartno = '" & strPartNo & "'"

Table(recordset):

fpartno                 fprice            fid
VR234234            2.15            V1-01
VR234234            1.50            V1-03
VR234234            .50              V1-02
VR345345            3.00            V4-01
VR235456            5.20            V3-01

I want to filter the above recordset and loop through the records.
Currently, the filter only get the first record and not the other two.

Thanks

Show quoteHide quote
"Alastair MacFarlane" <AlastairMacFarl***@discussions.microsoft.com> wrote
in message news:1CAB53FC-20C9-480D-A134-6B4C72F9DD4B@microsoft.com...
> George,
>
> You would really need to give the group the filter statement and an
> explanation of what type of data (with sample values) are being filitered.
>
> Alastair MacFarlane
>
> "george" wrote:
>
>> I have a recordset with data that I want to filter.  I use the filter
>> method
>> based my query and it filters the recordset.  However, my question is why
>> does it only display one row of data when the query should get multiple
>> records?
>>
>> Thanks
>>
>>
>>
Author
20 Mar 2006 5:51 PM
Bob Butler
"george" <george@spamme.com> wrote in message
news:OS2QcHETGHA.4452@TK2MSFTNGP12.phx.gbl
> Sorry about that.  Here is the code:
>
> strPartNo = 'VR234234'

That's not valid VB syntax; you should always copy & paste the EXACT code

> rsData.Filter = "fpartno = '" & strPartNo & "'"
>
> Table(recordset):
>
> fpartno                 fprice            fid
> VR234234            2.15            V1-01
> VR234234            1.50            V1-03
> VR234234            .50              V1-02
> VR345345            3.00            V4-01
> VR235456            5.20            V3-01
>
> I want to filter the above recordset and loop through the records.
> Currently, the filter only get the first record and not the other two.

You aren't showing the code you use to move to the first record and then
loop through the recordset.

--
Reply to the group so all can participate
VB.Net: "Fool me once..."
Author
20 Mar 2006 5:56 PM
george
Sorry, here it is:

rsData.MoveFirst
Do Until rsData.EOF
            msgbox rsData!fprice
            rsData.MoveNext
Loop

Show quoteHide quote
"Bob Butler" <tiredofit@nospam.com> wrote in message
news:%238rvnbETGHA.5828@TK2MSFTNGP14.phx.gbl...
> "george" <george@spamme.com> wrote in message
> news:OS2QcHETGHA.4452@TK2MSFTNGP12.phx.gbl
>> Sorry about that.  Here is the code:
>>
>> strPartNo = 'VR234234'
>
> That's not valid VB syntax; you should always copy & paste the EXACT code
>
>> rsData.Filter = "fpartno = '" & strPartNo & "'"
>>
>> Table(recordset):
>>
>> fpartno                 fprice            fid
>> VR234234            2.15            V1-01
>> VR234234            1.50            V1-03
>> VR234234            .50              V1-02
>> VR345345            3.00            V4-01
>> VR235456            5.20            V3-01
>>
>> I want to filter the above recordset and loop through the records.
>> Currently, the filter only get the first record and not the other two.
>
> You aren't showing the code you use to move to the first record and then
> loop through the recordset.
>
> --
> Reply to the group so all can participate
> VB.Net: "Fool me once..."
>
Author
20 Mar 2006 6:30 PM
Jeff Johnson [MVP: VB]
"george" <george@spamme.com> wrote in message
news:OS2QcHETGHA.4452@TK2MSFTNGP12.phx.gbl...

> fpartno                 fprice            fid
> VR234234            2.15            V1-01
> VR234234            1.50            V1-03
> VR234234            .50              V1-02
> VR345345            3.00            V4-01
> VR235456            5.20            V3-01
>
> I want to filter the above recordset and loop through the records.
> Currently, the filter only get the first record and not the other two.

Are you ABSOLUTELY positive that none of your fpartnos contain extraneous
spaces at the end? This may cause the filter not to match them.
Author
20 Mar 2006 7:03 PM
george
Jeff,

Thanks for the post.  Right after I posted the code it came to me that was
the problem and it was.  Thanks for all the posts and sorry for my dumb
mistake.

Thanks

Show quoteHide quote
"Jeff Johnson [MVP: VB]" <i.get@enough.spam> wrote in message
news:eJNiixETGHA.5924@TK2MSFTNGP09.phx.gbl...
>
> "george" <george@spamme.com> wrote in message
> news:OS2QcHETGHA.4452@TK2MSFTNGP12.phx.gbl...
>
>> fpartno                 fprice            fid
>> VR234234            2.15            V1-01
>> VR234234            1.50            V1-03
>> VR234234            .50              V1-02
>> VR345345            3.00            V4-01
>> VR235456            5.20            V3-01
>>
>> I want to filter the above recordset and loop through the records.
>> Currently, the filter only get the first record and not the other two.
>
> Are you ABSOLUTELY positive that none of your fpartnos contain extraneous
> spaces at the end? This may cause the filter not to match them.
>
Author
20 Mar 2006 4:45 PM
Paul Clement
On Mon, 20 Mar 2006 08:18:59 -0700, "george" <george@spamme.com> wrote:

¤ I have a recordset with data that I want to filter.  I use the filter method
¤ based my query and it filters the recordset.  However, my question is why
¤ does it only display one row of data when the query should get multiple
¤ records?

You might want to post a sample of your code so we can see exactly what you are doing.


Paul
~~~~
Microsoft MVP (Visual Basic)