Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error 3265

Status
Not open for further replies.

kimtp

Programmer
Jun 15, 2002
310
US
I receive this error 'item can not be found in the collection correpsonding to the requested name or ordinal'. Previously, all I had to do was to correct a misspelled name. However, this time it seems that all is correct. I've checked all names in the tblNotes and nothing seems to be misspelled. Here is the code:

Public Sub NotesFindDupe(ByVal lngID As Long, ByRef sNoteDate As String, ByRef bNoteFound As Boolean)
sSql = "SELECT ID From tblNotes WHERE ID = " & lngID
rsState
rs.Open sSql, cn
If rs.EOF Then
bNoteFound = False
Else
bNoteFound = True
End If
End Sub

Can't get past the rs.open. Any help is appreciated.
Thanx.

Kim
 
I think the connection is not properly initialized or has a reference to a non-existing table or database.

Hope this helps
 
There are multiple tables and to get to this point the program is able to connect and bring back data from all tables but this one.
 
Hello,
Have you had any luck in discovering why you were getting the "Item not found.... requested name or ordinal". I have been looking at this error for 48 hours and cannot find the cause. I am doing an INSERT to a Oracle db and this code was working for 2 years. Of course I have looked over all the field names, order of insert, etc... at least 15 times and there is nothing wrong inthe SQL. Any help???
 
What's the datatype of ID in tblNotes in your database?

Ok, I'll, bite: what's "rsState"?
 
'item can not be found in the collection correpsonding to the requested name or ordinal' indicates that data is being requested for an item not found in the database.

For example if the field name is MaidenName and the request is for rs!MaidneName you will get the error msg item can not be found.

Hope this helps.

Kim
 
So, does just using

Select * From tblNotes

(no criteria)
work?

And, as harebrain asked, what is is the line

rsState

for?
 
And, to elaborate on my "what is the datatype?" question, a mismatch there, too, could foul the query in this manner.
 
Hi Kim

Just a suggestion, which may or may not work:

Change the field name from ID to a non-reserved word. The name ID could be tripping up somewhere on a reserved word. May I suggest ID_Number?

Cassie
 
Yes, 'Select * From tblNotes' does the job. rsState should have read:

If rs.State = adStateOpen Then 'rs is the recordset
rs.Close
End If


ID works as is. But it is a good idea to not use it.

Thanx to all for the help/suggestions.

Kim
 
Maybe a good question here is which database server are we looking at? "ID" isn't reserved in either SQL Server or MS Access. In fact, it's the default name of an Access-supplied primary key.

David
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top