antonyx
Arsenal Supporter
- Local time
- Today, 16:34
- Joined
- Jan 7, 2005
- Messages
- 556
this code doesnt delete from both tables.. how should i structure this code to delete two records from 2 separate tables..
Code:
Private Sub btnDeleteInvoice_Click()
Dim strSql As String
If Nz(Me.[lstInvoiceRefs], -1) = -1 Then
MsgBox "Please select an Invoice to delete!", vbExclamation
Exit Sub
End If
strSql = "DELETE FROM tblInvoice WHERE (((tblInvoice.InvoiceRef)= '" & Me.[lstInvoiceRefs] & "'));"
strSql = "DELETE FROM tblJobInvoice WHERE (((tblJobInvoice.fkInvoiceRef)= '" & Me.[lstInvoiceRefs] & "'));"
DoCmd.SetWarnings False
DoCmd.RunSQL strSql
DoCmd.SetWarnings True
DoCmd.RunCommand acCmdSaveRecord
Me.lstNoInvoice.Requery
Me.lstInvoice.Requery
Me.lstInvoiceRefs.Requery
Me.Requery
End Sub