If Not (Me.frmBookDetailsSub.Form.Recordset.EOF And Me.frmBookDetailsSub.Form.Recordset.BOF) Then
If MsgBox("Are you sure to delete?", vbYesNo) = vbYes Then
'delete row
CurrentDb.Execute "DELETE FROM tblBookDetails " & _
"WHERE BookDetailsID=" & Me.frmBookDetailsSub.Form.Recordset.Fields("bookdetailsid")
'refresh data in sub form
Me.frmBookDetailsSub.Form.Requery