Guest User

Untitled

a guest
Jan 21st, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. Error number -2147417848: Method ‘FindFirst’ of object ‘Recordset2’ failed.
  2.  
  3. Private Sub Form_BeforeUpdate(Cancel As Integer)
  4. On Error GoTo ErrorHandler
  5. Dim strMsg As String
  6. Dim iResponse As Integer
  7.  
  8. 'Specify the mesage to display
  9. strMsg = "Do you wish to save the changes?" & Chr(10)
  10. strMsg = strMsg & "Click Yes to Save or No to Discard changes."
  11.  
  12. 'Display the msg box
  13. iResponse = MsgBox(strMsg, vbQuestion + vbYesNo, "Save Record?")
  14.  
  15. 'Check response
  16. If iResponse = vbNo Then
  17. 'Undo the change.
  18. MsgBox "undo"
  19. DoCmd.RunCommand acCmdUndo
  20. 'Cancel the update
  21. Cancel = True
  22. End If
  23.  
  24. Exit Sub
  25.  
  26. ErrorHandler:
  27. MsgBox "Error number " & Err.Number & ": " & Err.Description
  28. End Sub
  29.  
  30. Private Sub cboSalePicker_AfterUpdate()
  31. On Error GoTo ErrorHandler
  32.  
  33. Me.Recordset.FindFirst "[SaleID] = " & Str(Nz(cboSalePicker.Value, 0))
  34.  
  35. Exit Sub
  36. ErrorHandler:
  37. MsgBox "Error number " & Err.Number & ": " & Err.Description
  38. End Sub
Add Comment
Please, Sign In to add comment