Compile error: Method of data not found.....

pedie

Well-known Member
Joined
Apr 28, 2010
Messages
3,875
Hi, I'm trying to open recordset with data and then edit it and it error. where 'm i doing wrong. Do i need to open differently?


Thanks in advance.


Code:
[/FONT]
[FONT=Courier New]Option Compare Database[/FONT]
[FONT=Courier New]Sub dfgsdfhdcvbxcv()
Dim cnn As ADODB.Connection
Set cnn = CurrentProject.Connection
Dim MyRecordset As New ADODB.Recordset[/FONT]
[FONT=Courier New]MyRecordset.ActiveConnection = cnn
Dim MySQL As String[/FONT]
[FONT=Courier New]MySQL = "Select * FROM JOBS WHERE JOBS =" & "'XJOB11'"[/FONT]
[FONT=Courier New]MyRecordset.Open MySQL
While Not MyRecordset.EOF
 Debug.Print MyRecordset!JOBS
[COLOR=blue]  MyRecordset.Edit[/COLOR]
   MyRecordset!CLINTID = 7
  MyRecordset.Update
 
MyRecordset.MoveNext
Wend[/FONT]
[FONT=Courier New]MyRecordset.Close
Set MyRecordset = Nothing[/FONT]
[FONT=Courier New]End Sub
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
What if you do it this way:
Rich (BB code):
Dim MyRecordset As New ADODB.Recordset
Dim MySQL As String
 
MySQL = "Select * FROM JOBS WHERE JOBS ='XJOB11'"
 
MyRecordset.Open MySQL, cnn, adOpenDynamic, adLockOptimistic
Do Until MyRecordset.EOF
 
MyRecordset.Edit
 
Upvote 0
Well, if it is still not working, then how about doing a DECOMPILE on the database (be sure to keep a copy BEFORE you do, just in case something goes wrong). I don't see anything else that should logically cause a problem.
 
Upvote 0
Thats leads to another questin Bob:biggrin:, my apologies for my ignorance...
What's "DECOMPILE ", how do I decomplile? Is there some procedure i can follow?

Well, if it is still not working, then how about doing a DECOMPILE on the database (be sure to keep a copy BEFORE you do, just in case something goes wrong). I don't see anything else that should logically cause a problem.
 
Upvote 0

Forum statistics

Threads
1,224,527
Messages
6,179,348
Members
452,907
Latest member
Roland Deschain

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top