MarcGraff
asked on
Filter Error?
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
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
Needs to be something like this
Tbl_System.DB_Recs.Filter = "SysID = " & 6
Tbl_System.DB_Recs.Filter = "SysID = " & 6
ASKER
No diffrence. :(
- Marc
- Marc
Try this: -
Tbl_System.DB_Recs.Filter = "SysID = 6"
Should work!
Tbl_System.DB_Recs.Filter = "SysID = 6"
Should work!
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.
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.
ASKER
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.Filt er = "ID=2" 'works fine
The problem must be elsewhere... I just can't find it.
- Marc
This class modual is defined as Tbl_System. Unfortunetly this class modual works elsewhere...
For example: Tbl_Exeptions.DB_Recs.Filt
The problem must be elsewhere... I just can't find it.
- Marc
>>Tbl_System.DB_Recs is a recordset.
Is is a ADO recordset ?
Is is a ADO recordset ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
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.
ASKER
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
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
ASKER
- Marc