Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Filter Error?

Posted on 2003-11-12
11
Medium Priority
?
244 Views
Last Modified: 2010-05-01
code:
     Tbl_System.DB_Recs.Filter = "SysID=6"

Error:
     "Item cannot be found in the collection corresponding to the requested name or ordinal."

I have no idea what is wrong! Help!

   - Marc

Here is the SQL:
     SELECT SysID, SysData FROM Tbl_System
0
Comment
Question by:MarcGraff
  • 4
  • 3
  • 2
  • +2
11 Comments
 
LVL 1

Author Comment

by:MarcGraff
ID: 9734041
Tbl_System.DB_Recs is a recordset.

   - Marc
0
 
LVL 4

Expert Comment

by:TomLaw1999
ID: 9734091
Needs to be something like this

Tbl_System.DB_Recs.Filter = "SysID = " & 6
0
 
LVL 1

Author Comment

by:MarcGraff
ID: 9734322
No diffrence. :(

   - Marc
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 5

Expert Comment

by:rpai
ID: 9735113
Try this: -
Tbl_System.DB_Recs.Filter = "SysID = 6"

Should work!

0
 
LVL 5

Expert Comment

by:rpai
ID: 9735148
Oops.. did not realize that you were using the same exact code. Sorry!

I suppose you are using VB6.
How have you declared the Tbl_System.DB_Recs as recordset?

Doing this
Dim Tbl_System.DB_Recs  as ADODB.Recordset
is likely to yield an error.

Try
Dim TblSystem as ADODB.Recordset instead.

Hopefully the filter property of the recordset should work.



0
 
LVL 1

Author Comment

by:MarcGraff
ID: 9735189
Yeah, DB_Recs is in a class modual.

This class modual is defined as Tbl_System. Unfortunetly this class modual works elsewhere...

For example: Tbl_Exeptions.DB_Recs.Filter = "ID=2"                    'works fine

The problem must be elsewhere... I just can't find it.

   - Marc
0
 
LVL 5

Expert Comment

by:rpai
ID: 9735316
Please read this :- http://www.adopenstatic.com/faq/800a0cc1.asp
Might be of help.

0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 9736679
>>Tbl_System.DB_Recs is a recordset.

Is is a ADO recordset ?
0
 
LVL 39

Accepted Solution

by:
appari earned 2000 total points
ID: 9736817
to make sure that recordset is using the same SQL as you are thinking, add this line and post the result printed in debug window here

debug. print Tbl_System.DB_Recs.Source
Tbl_System.DB_Recs.Filter = "SysID=6"
0
 
LVL 4

Expert Comment

by:TomLaw1999
ID: 9738154
Marc are you still having a problem. I believed that the error message was because you included the  = 6 bit within quotation marks i.e. "SysID=6" was not recognised but "SysID" should be.

If my original suggestion did not work i.e. Tbl_System.DB_Recs.Filter = "SysID = " & 6
 then try

Dim X as long
X=6
Tbl_System.DB_Recs.Filter = "SysID = " & X

Should'nt make any real difference but be especially careful about the positioning of the quotation marks and leave a space between the = sign and the last quotation mark.

 
0
 
LVL 1

Author Comment

by:MarcGraff
ID: 9740468
Hey! appari, your right!

I initialized it as:
SELECT SysID, SysData FROM Tbl_System

By using debug I found that the select statement has been changed! So I went back and found that I accidentally reinitialized it to another select statement. I have corrected the problem and it works great! Thanks so much!

   - Marc
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

876 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question