I used the access wizard to place a delete record button on the form. It worked fine until I added an unbound control to the form that I updated via the on current event.
I modified the cmdDelete button's event as follows:
*** The error I get is Runtime Error 3167. The record is deleted ****
Private Sub cmdDelete_Click()
On Error GoTo Err_cmdDelete_Click
' Delete the item
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
** !!!! ON CURRENT EVENT FIRES HERE !!! CAUSING AN ERROR **
' rest of code cut for brevity reasons
' Here is my On Current event
Private Sub Form_Current()
' Used for navigation buttons
acbHandleCurrent Me ' This code executes fine.
HandleUnboundControls ' This code raises error
' Update any unbound controls on the form
Private Sub HandleUnboundControls()
** Code below raises error at the evaluation of the if statement when I first read Recordset.absoluteposition
** if I press continue the code contines without further error. Any thoughts???
If (Recordset.AbsolutePosition = -1) Then
cmbItem = Null
cmbDescription = Null
cmbItem = Recordset!ITEM
cmbDescription = Recordset!DESCRIPTION