I have a subform in a form in Access and I need to delete item from it based on two other pieces of information in the form.
The problem I am running into is that one of these pieces of information is in a secondary table.
This should clear it up further:
Table1: ActID, STOid
Table2 (the one I need to delete from): tableid, ActID, ActDate
The form provides the ActDate and the STOid.
I want to delete based on the ActDate and STOid selected in the form.
This is what I have so far, but I know it isn't correct. I am not sure how to make the connection with table1.
Private Sub btn_DeleteAll_Click()
Dim msgRes As VbMsgBoxResult
Dim strsql As String
msgRes = MsgBox("Are you sure you want to reset your report?", vbOKCancel, "Reset Report")
If msgRes = vbCancel Then
strsql = "Delete from Act_SubTO_Date where [ActDate] = " & Forms("frm_Act_Enter").[Sub_frm_Act_enter_crntrpt].Form.[ActDate] AND [Activities].[STOid] = " & Forms("frm_Act_Enter").[Sub_frm_Act_enter_crntrpt].Form.[cmbsto]"
Thank you, in advance!