I have a frm_New_SOW (Mainform) with a sbfrm_New_SOW. User selects a customer(from customer table) on the main form and fills out information on the subform for that customer (this gets put into tbl_ALL_SOW.) Forms are linked by a customer id. Customers can have multiple SOW's.
I would like to be able to close the form without the information being saved to the table. I do have a save & close but users want the option to not save & close.The fields are bound so I have tried running a delete query among other things. I don't want to delete the customer, only the sow for that customer.
Here are some things I have tried, if there some way to improve upon these ideas or a better way to accomplish what I want any help is appreciated!!
Me.sbfrm_New_SOW.Form.Recordset.Delete
'this deletes the record from tbl_SOW but it replaces the first customer in the tbl_customer with the deleted customer. so close!
'Dim strSQL As String
'Dim vMyID
'vMyID = Me.sbfrm_New_SOW.Form![SOW_NUM]
'strSQL = "DELETE * FROM tbl_ALL_SOW WHERE ((Me.txt_ALL_CUST_ID)=" & vMyID & ");"
'this says it can't find the field ALL_CUST_ID (i have double checked that is what it is named)
'Me.sbfrm_New_SOW.SetFocus
'With Me.sbfrm_New_SOW
'DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
'DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
'End With
'this deletes the record from tbl_ALL_SOW and renames the customer in the cust table with the current deleted customer
'DoCmd.RunSQL "DELETE * FROM tbl_ALL_SOW WHERE ALL_CUST_ID = " & Forms![sbfrm_New_SOW]![SOW_Num] & " ;"
'this says it can't find the sbfrm, but i have checked everywhere, i don't see another name, this is what populates if you start typing me.
DoCmd.Close acForm, "frm_New_SOW"
Thanks!!!
I would like to be able to close the form without the information being saved to the table. I do have a save & close but users want the option to not save & close.The fields are bound so I have tried running a delete query among other things. I don't want to delete the customer, only the sow for that customer.
Here are some things I have tried, if there some way to improve upon these ideas or a better way to accomplish what I want any help is appreciated!!
Me.sbfrm_New_SOW.Form.Recordset.Delete
'this deletes the record from tbl_SOW but it replaces the first customer in the tbl_customer with the deleted customer. so close!
'Dim strSQL As String
'Dim vMyID
'vMyID = Me.sbfrm_New_SOW.Form![SOW_NUM]
'strSQL = "DELETE * FROM tbl_ALL_SOW WHERE ((Me.txt_ALL_CUST_ID)=" & vMyID & ");"
'this says it can't find the field ALL_CUST_ID (i have double checked that is what it is named)
'Me.sbfrm_New_SOW.SetFocus
'With Me.sbfrm_New_SOW
'DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
'DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
'End With
'this deletes the record from tbl_ALL_SOW and renames the customer in the cust table with the current deleted customer
'DoCmd.RunSQL "DELETE * FROM tbl_ALL_SOW WHERE ALL_CUST_ID = " & Forms![sbfrm_New_SOW]![SOW_Num] & " ;"
'this says it can't find the sbfrm, but i have checked everywhere, i don't see another name, this is what populates if you start typing me.
DoCmd.Close acForm, "frm_New_SOW"
Thanks!!!