September 15, 2005 at 3:43 am
Hi
I am trying to edit (date) a field in a table where the table row has the same unique field as a form's Recordset. I have obviously got the code wrong somewhere, and am hoping that someone can point me in the right direction.
Thanks
Paul
---------------
The following code produces the error:
'Operation is not allowed in this context'
The error comes at the aud.close line.
Dim rs As ADODB.Recordset
Set rs = Me.RecordsetClone
Dim Hld As Long
Dim strSQL As String
Dim AUD As ADODB.Recordset
Set AUD = New ADODB.Recordset
rs.MoveFirst
Do While Not rs.EOF
Hld = rs!RUL_Code
strSQL = "SELECT * FROM tblRul_Adds " & _
"where rul_code=" & Hld
AUD.Open strSQL, CurrentProject.Connection, adOpenStatic, adLockOptimistic
AUD!Completed = Date
AUD.Close --(error occurrs here)
rs.MoveNext
Loop
rs.Close
September 15, 2005 at 5:44 am
Try open your recordset dynamic
AUD.Open strSQL, CurrentProject.Connection, adOpenDynamic, adLockOptimistic
Anders Dæmroen
epsilon.no
September 15, 2005 at 8:23 am
Hi Anders
Thanks for your reply. Unfortunately I still get the same error message as before.
I think my code makes sense. Its difficult to see where the error is other than the static/dynamic. However, there must be something.....
Thanks again
Paul
September 15, 2005 at 8:34 am
My apologies.
aud.update
The problem was staring at me but I couldn't see it. It is amazing how something so obvious catches you out.
Thanks
Paul
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply