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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADO Recordset - Find Method

Status
Not open for further replies.

Elena

Technical User
Oct 20, 2000
112
US
Hi,

OK, what am I doing wrong? I am getting the error "3265 - Item cannot be found in the collection corresponding to the requested name or ordinal." The Find method seems to work, because the EOF is false when I get the error. I have checked the names and data types, but I can't see anything wrong.

rstModels.MoveFirst
rstModels.Find "ModelNumber = '" & cmbModels.Text & "'"
If Not rstModels.EOF Then
OpDriveType(rstModels!DeviceTypeID) = vbChecked
If rstModels!Profile = "Slim" Then
chkSlim.Value = vbChecked
Else
chkSlim.Value = vbUnchecked
End If
End If

DeviceTypeID corresponds to the OpDriveType option button array index value that was loaded earlier.

Thanks,
Elena
 
OptionButton.Value is Boolean, Checkbox.Value is Integer.

Try

OpDriveType(rstModels!DeviceTypeID).Value = True

Andy
"Logic is invincible because in order to combat logic it is necessary to use logic." -- Pierre Boutroux
 
Andy,

Well, I see you are right about that and I will change it. However, the problem I am having seems to be with the recordset. It doesn't know what the DeviceTypeID value is.

Any other ideas?

Thanks,

Elena
 
Oops - My bad.

I had changed a few things about how and when I was opening the recordset, and I neglected to change the SQL string in the process.

It's working now.

Thanks,

Elena
 
D'oh! I seem to be having real problems today reading the questions. Sorry!

This error usually occurs because the field name is mis-spelt, etc. Can you confirm that "DeviceTypeID" is the correct field name, and that the value of DeviceTypeID is within the bounds of the OpDriveType control array? I've shot myself in the foot a couple of times when I've added controls to a control array and missed an index or two (e.g. I've got items 0,1,2,5,6 and I was trying to access item 4)

Andy
"Logic is invincible because in order to combat logic it is necessary to use logic." -- Pierre Boutroux
 
Andy,

Actually, the option group was created dynamically based on the DeviceTypeID field from the database. I did that so that the index of the option button would be identical to the DeviceTypeID.

Thanks for your help.

Elena
 
I have a horrible feeling we're missing something blindingly obvious. Could I trouble you to post the entire routine, and the rstRecords.Open, etc. ?

Andy
"Logic is invincible because in order to combat logic it is necessary to use logic." -- Pierre Boutroux
 
Andy,

As I already mentioned in a previous post, the problem has been solved. I wasn't using the correct SQL statement.

Thanks for the help.

Elena
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top