I have the normal add button code that access puts in for me when i create the button. And my delete button code is as follows:
Private Sub DeleteRecord_Click()
Dim rst As DAO.Recordset, Cri As String, SQL As String
Dim Msg As String, Style As Integer, Title As String
Cri = "[MaterialCode] = '" & Me!MaterialCode & "' AND " & _
"[Y-Dimension] = '" & Me![Y-Dimension] & "' AND " & _
"[X-Dimension] = '" & Me![X-Dimension] & "'"
Set rst = Me.RecordsetClone
rst.FindFirst Cri
If rst.NoMatch Then
Msg = "Combined BarCode Record Not Found or Doesn't Exist!"
Style = vbInformation + vbOKOnly
Title = "Can't Find Combined BarCode! . . ."
MsgBox Msg, Style, Title
Else
SQL = "DELETE FROM REF " & _
"WHERE " & Cri
DoCmd.RunSQL SQL
End If
Set rst = Nothing
End Sub