Question : SQL Server back-end not deleting record

I have an application with an Access 2003 front-end and a SQL Server 2005 back-end.  On one of the forms I have a "Delete" button that runs the following code:

    Dim answer As Integer
    answer = MsgBox("Are you sure that you want to delete the contract with reference " number '" & ContractReferenceNumber.Value & "' and all related invoices?", vbYesNo)
    If answer = vbYes Then
        DoCmd.RunCommand acCmdSelectRecord
        DoCmd.RunCommand acCmdDeleteRecord
        DoCmd.OpenForm "FindFinanceForm"
        Forms("FindFinanceForm")!FilterFinanceContractSubform.Form.Requery
        DoCmd.Close acForm, Me.Name, acSaveNo
    End If

The code seems to run fine and I get all of the confirmation messages, including the Access "You are about to delete 1 record(s).", but it never actually deletes the record in the SQL Server database.  The same thing happens if choose "Select Record" and "Delete Record" from the menu while this form is displayed.  However, doing the same thing from table view does actually delete the record.  What is going on here?

Answer : SQL Server back-end not deleting record

Do your SQL Server tables have Primary Keys defined on them? This is critical.

Is your Form based on a Table or on a Query?

If a Query, are you absolutely certain the query is "updateable"? If not, you won't be able to Edit or Delete records.

Are you sure that you haven't set the AllowDeletions property of the Form to No/False?
Random Solutions  
 
programming4us programming4us