Advertisement

03.13.2008 at 12:06PM PDT, ID: 23239750
[x]
Attachment Details

Delete Command Button Not Deleting Record

Asked by alliedtech in Access Coding/Macros, Microsoft Access Database, Access Forms

Tags: Microsoft, Access, 2007

The below code is intended to delete the form record.  The subform data is deleted via the "delete cascading records" relationship option.  The button works with no errors and the final message box pops up and hte form is cleared.  However, the records are not deleted in the table.

The main form row source...
SELECT tblInvTrans.InvTransID, tblInvTrans.TransactionTypeID, tblInvTrans.TransactionDate, tblInvTrans.TransportTypeID, tblInvTrans.TransporterNum FROM tblInvTrans; Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
Private Sub cmdDelete_Click()
    If (MsgBox("Deleting a shipping ticket will permanently delete that ticket.  Are you sure you want to delete?", vbYesNo, "Delete Confirmation")) = vbYes Then
        If Me.Dirty Then
            Me.Undo
            DoCmd.SetWarnings False
        If Not Me.NewRecord Then
            RunCommand acCmdDeleteRecord
            DoCmd.SetWarnings True
        End If
        End If
        Me.txtTransactionDate.Enabled = True
        Me.cboPipeOD.Enabled = True
        Me.cboPipeOD = Null
        Me.cboPipeWall.Enabled = True
        Me.cboPipeWall = Null
        Me.tbctrlShipTicket.Visible = False
        Me.optTransportType.Enabled = True
        Me.txtTransporterNum.Enabled = True
        Me.cmdEnterData.Enabled = True
        MsgBox "The shipping ticket was successfully deleted.", , "Delete Confirmation"
        
    End If
End Sub
[+][-]03.13.2008 at 05:11PM PDT, ID: 21122037

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Access Coding/Macros, Microsoft Access Database, Access Forms
Tags: Microsoft, Access, 2007
Sign Up Now!
Solution Provided By: twintai
Participating Experts: 1
Solution Grade: A
 
 
[+][-]05.23.2008 at 06:45PM PDT, ID: 21637284

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]05.31.2008 at 08:05PM PDT, ID: 21685845

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628