Acess 365
I have a form called vendor (shows a list of Vendors), with a subform called VendorVariable (to add a Vendor that is in the t_Vendor table to the t_VendorVariable table. I then want the Vendor added to the t_VendorVariable table via the subform to delete the same Vendor from the t_Vendor Table.
I am trying to end up with two tables separating the Vendors with the similiarly named vendors....
FYI the Vendors added to the t_VendorVariable table via the subform are Vendors that are the same but are spelled differently. i.e. st.Joseph and Saint Joseph.
When I add a record in the subform I want it to automatically delete the Vendor record from the t_Vendor table where the VendorVariable is the one just added via the subform.
In other words if a new Vendor record is added to t_VendorVariable, the vendor with the same name should be deleted from the t_Vendor table.
How and where do I add the delete code?
I tried putting at the save button of the subform. I pops up a "Enter Parameter Value" box for the Vendor Name that was entered
Private Sub btnSave_Click()
On Error GoTo btnSave_Click_Err
On Error Resume Next
DoCmd.RunCommand acCmdSaveRecord
If (MacroError <> 0) Then
Beep
MsgBox MacroError.Description, vbOKOnly, ""
End If
DoCmd.SetWarnings False
strSQL = "Delete * From t_Vendor WHERE Vendor= " & Me.VendorVariation.Value
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True
I have a form called vendor (shows a list of Vendors), with a subform called VendorVariable (to add a Vendor that is in the t_Vendor table to the t_VendorVariable table. I then want the Vendor added to the t_VendorVariable table via the subform to delete the same Vendor from the t_Vendor Table.
I am trying to end up with two tables separating the Vendors with the similiarly named vendors....
FYI the Vendors added to the t_VendorVariable table via the subform are Vendors that are the same but are spelled differently. i.e. st.Joseph and Saint Joseph.
When I add a record in the subform I want it to automatically delete the Vendor record from the t_Vendor table where the VendorVariable is the one just added via the subform.
In other words if a new Vendor record is added to t_VendorVariable, the vendor with the same name should be deleted from the t_Vendor table.
How and where do I add the delete code?
I tried putting at the save button of the subform. I pops up a "Enter Parameter Value" box for the Vendor Name that was entered
Private Sub btnSave_Click()
On Error GoTo btnSave_Click_Err
On Error Resume Next
DoCmd.RunCommand acCmdSaveRecord
If (MacroError <> 0) Then
Beep
MsgBox MacroError.Description, vbOKOnly, ""
End If
DoCmd.SetWarnings False
strSQL = "Delete * From t_Vendor WHERE Vendor= " & Me.VendorVariation.Value
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True