Randomblink
The Irreverent Reverend
- Local time
- Today, 16:02
- Joined
- Jul 23, 2001
- Messages
- 279
Error Description: Update or CancelUpdate without AddNew or Edit. Error Number: 3020 Source: DAO.Recordset
I have update buttons that run like this one:
*****************************************
Private Sub btnPrintSlip_Click()
Dim rst As Recordset
On Error GoTo ErrPrintSlip
Set rst = Me.Recordset
Select Case Me.Dirty
Case -1 'Yes, the Form is Dirty
Select Case Me.NewRecord
Case -1 ' Yes, the Form is Dirty AND this is a NEW RECORD
rst.Update
Case 0 ' Yes, the Form is Dirty BUT this is NOT a NEW RECORD
With rst
.Edit
.Update
End With
End Select
Case 0 ' No the Form is NOT Dirty
End Select
Select Case Pprwrk_Type
Case "Invoice": DoCmd.OpenReport "rptInvoiceRoutingSlip", , , "[Pprwrk_ID] =" & Me.Pprwrk_ID
Case "RFA": DoCmd.OpenReport "rptRFATrackingSlip", , , "[Pprwrk_ID] =" & Me.Pprwrk_ID
End Select
Exit_PrintSlip:
Exit Sub
ErrPrintSlip:
MsgBox Err.Description
Resume Exit_PrintSlip
End Sub
*****************************************
Can someone point out what is wrong? Help!
Thanks in advance...
I have update buttons that run like this one:
*****************************************
Private Sub btnPrintSlip_Click()
Dim rst As Recordset
On Error GoTo ErrPrintSlip
Set rst = Me.Recordset
Select Case Me.Dirty
Case -1 'Yes, the Form is Dirty
Select Case Me.NewRecord
Case -1 ' Yes, the Form is Dirty AND this is a NEW RECORD
rst.Update
Case 0 ' Yes, the Form is Dirty BUT this is NOT a NEW RECORD
With rst
.Edit
.Update
End With
End Select
Case 0 ' No the Form is NOT Dirty
End Select
Select Case Pprwrk_Type
Case "Invoice": DoCmd.OpenReport "rptInvoiceRoutingSlip", , , "[Pprwrk_ID] =" & Me.Pprwrk_ID
Case "RFA": DoCmd.OpenReport "rptRFATrackingSlip", , , "[Pprwrk_ID] =" & Me.Pprwrk_ID
End Select
Exit_PrintSlip:
Exit Sub
ErrPrintSlip:
MsgBox Err.Description
Resume Exit_PrintSlip
End Sub
*****************************************
Can someone point out what is wrong? Help!
Thanks in advance...