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

Help: Operation is not supported for this type of object 1

Status
Not open for further replies.

shar

Technical User
Apr 2, 2000
54
IR
I have a simple vb code to look in one table, record 2 values, go to next table, find the records with value1, paste value2.<br><br>Here is the code:<br><br>Function AddCStoCOtbl()<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim rs0, rs1 As Recordset<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim db As Database<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim tst, pw As String<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim cs As Long<br><br>&nbsp;&nbsp;&nbsp;&nbsp;Set db = CurrentDb()<br>&nbsp;&nbsp;&nbsp;&nbsp;Set rs0 = db.OpenRecordset(&quot;Projects&quot;)<br>&nbsp;&nbsp;&nbsp;&nbsp;Set rs1 = db.OpenRecordset(&quot;ChangeOrders&quot;)<br><br>rs0.MoveFirst<br>Do While Not rs0.EOF<br>&nbsp;&nbsp;&nbsp;&nbsp;pw = rs0![PW#]<br>&nbsp;&nbsp;&nbsp;&nbsp;cs = rs0![CS#]<br>&nbsp;&nbsp;&nbsp;&nbsp;tst = BuildCriteria(&quot;PW#&quot;, dbText, pw)<br>&nbsp;&nbsp;rs1.MoveFirst<br>&nbsp;&nbsp;rs1.FindFirst tst<br>&nbsp;&nbsp;&nbsp;&nbsp;If rs1.NoMatch Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GoTo jump_loop<br>&nbsp;&nbsp;&nbsp;&nbsp;End If<br>&nbsp;&nbsp;&nbsp;&nbsp;rs1.Edit<br>&nbsp;&nbsp;&nbsp;&nbsp;rs1![CS#] = cs<br>&nbsp;&nbsp;&nbsp;&nbsp;rs1.Update<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;Do While Not rs1.EOF<br>&nbsp;&nbsp;&nbsp;&nbsp;rs1.FindNext tst<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If rs1.NoMatch Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GoTo jump_loop<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End If<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rs1.Edit<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rs1![CS#] = cs<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rs1.Update<br>&nbsp;&nbsp;Loop<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>jump_loop:<br>rs0.MoveNext<br>Loop<br><br>rs0.Close<br>rs1.Close<br>db.Close<br>End Function<br><br>The first occurance of rs1.FindFirst tst I get the &quot;Operation is not supported for this type of object&quot; message.<br><br>Both tables have a text field PW#, so the 'tst' criteria does apply to rs1.<br><br>Any idea why this is happening?<br><br>Thanks.<br>Shar
 
r u using Access 2000 or 97 ??? <p>Mohamed Aly<br><a href=mailto:samara_79@hotmail.com>samara_79@hotmail.com</a><br><a href= > </a><br>
 
<br>I am using Access 97.<br><br>Shar
 
Shar,<br>You may need to force the type of recordset, ie <br>instead of :db.OpenRecordset(&quot;Projects&quot;)<br>do:<br>db.OpenRecordset(&quot;Projects&quot;,dbOpenDynaset)<br>The FindNext is not supported on table type recordsets, this may be what type Access decided on since you didn't explicitly specify.&nbsp;&nbsp;If that's not it, then try qualifying the Dim rs1 as:<br>Dim rs1 as DAO.recordset<br>--Jim
 
Thanks Jim, the Type declaration was the key.<br><br>Shar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top