A
Angi
I have a form that opens with the current CoID in it which
automatically makes it a new record whether the user inputs anything or
not. When the user closes the form, I want to delete the record if the
Last Name field is null but I'm getting the following error:
Run-time error '2406':
The command or action "SelectRecord" isn't available now.
I know it's because of the EditMenu, 8 line, but when I take it out, it
still doesn't delete the record. It doesn't refresh the main form, but
once you close and go back in, a blank entry is there. What do I need
to do to get this code to work?
Private Sub Form_Close()
If (Not IsNull(Me![LastName])) Then
Forms!companymain.Requery
Else
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
End If
End Sub
TIA!
automatically makes it a new record whether the user inputs anything or
not. When the user closes the form, I want to delete the record if the
Last Name field is null but I'm getting the following error:
Run-time error '2406':
The command or action "SelectRecord" isn't available now.
I know it's because of the EditMenu, 8 line, but when I take it out, it
still doesn't delete the record. It doesn't refresh the main form, but
once you close and go back in, a blank entry is there. What do I need
to do to get this code to work?
Private Sub Form_Close()
If (Not IsNull(Me![LastName])) Then
Forms!companymain.Requery
Else
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
End If
End Sub
TIA!