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

Update or cancelupdate without addnew or edit 1

Status
Not open for further replies.

Stuey111

Programmer
Jun 5, 2009
3
GB
Hi,

I am having some trouble with this code, the code is supposed to change the form to show the record which is selected from a list box. The code appears to work with some records but on some occasions it just appears to come up with the error:

Runtime Error '3020':

Update or CancelUpdate without AddNew or Edit

Any help with why this is occuring and a solution would be greatly appreciated.

Please see code below:

Code:
Private Sub List76_AfterUpdate()
            
    'Find the record that matches the control.
    Dim rs As Object
    Dim PRN As String
    
    PRN = Str(Nz(Me![List76], 0))
    
    Set rs = Me.Recordset.Clone
    rs.FindFirst "[Project Reference Number] =" & PRN
    
    If Not rs.EOF Then Me.Bookmark = [B]rs.Bookmark[/B]
End Sub

The debug seems to happen where i have made the text bold.

Thanks

Stuart
 
It works for me. I suspect you have something going on in another event that is causing this problem.


It seems odd to be searching for a string in a numeric field. Text fields require delimiters.

 
I have just found something out - it only appears to be bringing this error up when the relevant project is Queued, thanks for the response remou, i have changed the data type and still getting the same error but as i have just found out - it only appears to be happening when a project has a [project status] of queued.
 
So happens in events when you have a status of queued? The error usually occurs when a recordset is being updated but the first bit is missing (DAO):

rs!FieldX="Blah"
rs.Update

Should be:

rs.Edit 'or rs.AddNew
rs!FieldX="Blah"
rs.Update


 
Thanks for your suggestions on this, i have managed to fix it somehow but to be really honest i am actually not sure how....

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top