G
Guest
Hello;
I am writing the following VBA code that will enable a user to delete
records from 2 tables (Children + Parent). Then I would like the form to
update. This is what I have.
Any suggestions would be much appreciated.
' MsgBox asking the user if 'Y/N' they would like to delete
If Response = vbYes Then ' User chose Yes.
'Delete Children
strSQL = "DELETE * " & _
"FROM tblTariffs " & _
"WHERE RPID = " & Me.RPID
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
'Delete Parent
strSQL = "DELETE *" & _
"FROM tblRePrice " & _
"WHERE RPID =" & Me.RPID
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
Else ' User chose No.
Exit Sub
End If
'Update Form
strSQL = "SELECT RPID, ClientName AS [Client Name], VerifiedDate AS
Verified " & _
"FROM tblRePrice " & _
"GROUP BY RPID, ClientName, VerifiedDate " & _
"ORDER BY ClientName, VerifiedDate;"
DoCmd.RunSQL strSQL
Me.f_Options.Value = 1
I am writing the following VBA code that will enable a user to delete
records from 2 tables (Children + Parent). Then I would like the form to
update. This is what I have.
Any suggestions would be much appreciated.
' MsgBox asking the user if 'Y/N' they would like to delete
If Response = vbYes Then ' User chose Yes.
'Delete Children
strSQL = "DELETE * " & _
"FROM tblTariffs " & _
"WHERE RPID = " & Me.RPID
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
'Delete Parent
strSQL = "DELETE *" & _
"FROM tblRePrice " & _
"WHERE RPID =" & Me.RPID
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
Else ' User chose No.
Exit Sub
End If
'Update Form
strSQL = "SELECT RPID, ClientName AS [Client Name], VerifiedDate AS
Verified " & _
"FROM tblRePrice " & _
"GROUP BY RPID, ClientName, VerifiedDate " & _
"ORDER BY ClientName, VerifiedDate;"
DoCmd.RunSQL strSQL
Me.f_Options.Value = 1