V
vin defalco
i have a datasheet containing sheetmetal items it stands
as a subform data is entered one at a time if an error is
made the user can highlite the item and a delete button
is depressed and the item disappears it works great
except if an item is not highlited the entire file is
gone. here is the vb code for the button.
Private Sub btnRemovePiece_Click()
Dim pieceID, response
With Controls("lstSheetmetalData")
pieceID = .ItemData(.ListIndex + 1)
End With
If IsNull(pieceID) Then
MsgBox "A material must be selected in order to remove
it. Please try again." ***THIS INSTRUCTION DOES NOT
WORK***
Exit Sub
End If
response = MsgBox("Are you sure you want to remove this
piece?", vbYesNo)
If response = vbYesNo Then
CurrentDb.Execute "Delete FROM tblSheetmetal WHERE
id= & pieceID
Recalc
End If
End Sub
when nothing is highlighted and yes to delete is
depressed the entire file is deleted
Please help
thanks vinny
as a subform data is entered one at a time if an error is
made the user can highlite the item and a delete button
is depressed and the item disappears it works great
except if an item is not highlited the entire file is
gone. here is the vb code for the button.
Private Sub btnRemovePiece_Click()
Dim pieceID, response
With Controls("lstSheetmetalData")
pieceID = .ItemData(.ListIndex + 1)
End With
If IsNull(pieceID) Then
MsgBox "A material must be selected in order to remove
it. Please try again." ***THIS INSTRUCTION DOES NOT
WORK***
Exit Sub
End If
response = MsgBox("Are you sure you want to remove this
piece?", vbYesNo)
If response = vbYesNo Then
CurrentDb.Execute "Delete FROM tblSheetmetal WHERE
id= & pieceID
Recalc
End If
End Sub
when nothing is highlighted and yes to delete is
depressed the entire file is deleted
Please help
thanks vinny