Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    43
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Update without Edit error (Access 2003 SP2)

    I am receiving the following error message:
    Run-time error '-2147352567 (80020009)':
    Update or CancelUpdate without AddNew or Edit.

    In itself, that's a simple error, but I don't understand why I'm receiving the error because all my updates have an AddNew or Edit. I'm pasting the code below. The line being highlighted by the error is the one where I'm trying to change the value of me.itemcomplete in the current form. There's no "update" involved here, is there? <img src=/S/brickwall.gif border=0 alt=brickwall width=25 height=15>

    Private Sub Form_BeforeUpdate(Cancel As Integer)
    Dim Connxn As ADODB.Connection
    Dim rst As ADODB.Recordset
    If Me.QtyShipped <> 0 Then
    If Me.DateShipped > Date Then
    MsgBox "Date Shipped cannot be in the future", vbOKOnly, "Invalid Date"
    Me.DateShipped.SetFocus
    Else
    If Me.txtBackorder > 0 And bolCreateItem = False Then
    If Me.ItemComplete = False Then
    Set Connxn = CurrentProject.Connection
    Set rst = New ADODB.Recordset
    Me.ShipVia.Value = Me.txtShipVia.Value
    rst.Open "tblShippedItem", Connxn, adOpenKeyset, adLockPessimistic, adCmdTable
    With rst
    .AddNew
    .Fields("OrderDetailID") = Me.OrderDetailID.Value
    .Fields("QtyShipped") = 0
    .Fields("Price") = Me.tblOrderDetail_Price.Value
    .Fields("Per") = Me.Per.Value
    .Fields("DateShipped") = Null
    .Fields("ShipVia") = ""
    .Fields("WorkOrderNumber") = Me.WorkOrderNumber.Value
    .Update
    End With
    bolCreateItem = True
    rst.Close
    End If
    Else
    If Me.QtyShipped <> 0 Then
    Me.ItemComplete = True <-- this is the line that is highlighted if I choose "Debug" after receiving the error. What's up with that??
    End If
    End If
    End If
    End If
    Set rst = Nothing
    Set Connxn = Nothing
    End Sub

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Update without Edit error (Access 2003 SP2)

    I don't see anything in your code that would cause this error message. Could you post a stripped down copy of your database? See <post#=401925>post 401925</post#> for instructions.

  3. #3
    Lounger
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    43
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Update without Edit error (Access 2003 SP2)

    The database is altogether too large to strip down - I really can't afford the time to do that right now since I have to have this working by morning. I rolled back to a backup copy (it was working yesterday, after all), and I'm re-applying my changes one-at-a-time. If I find the change that caused the problem, I'll post it here. Glad to hear the code I posted was okay, though. Thanks for checking, Hans.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •