I have a form with a continuous subform. On the subform is a "checkbox" for each record. The checkbox is used to delete records from the subform. Also the checkbox is used to delete records from another table.
I am tryin' to figure out how to use the recordsetclone property of the subform to delete records from another table.
Below is what I am working with, and gettin' no-where fast..!!!
It checks to see if the PartMasterComments tbl has a matching WanNo via GBLWanNo (global variable), then if so delete the records from PartMasterComments that have a matching GBLWanNo, a matching IID in the subforms recordsetclone, and the checkbox is "true" in the subforms recordsetclone.
I sure hope this makes sense..!!
Any suggestions or other methods...???
Thanks for the help - in advance..!!!
jcw5107
If DCount("*", "PartMasterComments", "WanNo=" & GBLWanNo & "") > 0 Then
Dim rsTable As DAO.Recordset
Dim DeleteCt As Integer
Set rsTable = db.OpenRecordset("PartMasterComments")
Set rs = Me.PartsSubFrm.Form.RecordsetClone
DeleteCt = 0
rsTable.MoveFirst
Do While Not rsTable.EOF
If rsTable!WanNo = GBLWanNo And rsTable!IID = rs.Fields("IID") And rs.Fields("ForCoverSheet").Value = True Then
rsTable.Delete
DeleteCt = DeleteCt + 1
End If
rsTable.MoveNext
Loop
rsTable.Close
Set rs = Nothing
I am tryin' to figure out how to use the recordsetclone property of the subform to delete records from another table.
Below is what I am working with, and gettin' no-where fast..!!!
It checks to see if the PartMasterComments tbl has a matching WanNo via GBLWanNo (global variable), then if so delete the records from PartMasterComments that have a matching GBLWanNo, a matching IID in the subforms recordsetclone, and the checkbox is "true" in the subforms recordsetclone.
I sure hope this makes sense..!!
Any suggestions or other methods...???
Thanks for the help - in advance..!!!
jcw5107
If DCount("*", "PartMasterComments", "WanNo=" & GBLWanNo & "") > 0 Then
Dim rsTable As DAO.Recordset
Dim DeleteCt As Integer
Set rsTable = db.OpenRecordset("PartMasterComments")
Set rs = Me.PartsSubFrm.Form.RecordsetClone
DeleteCt = 0
rsTable.MoveFirst
Do While Not rsTable.EOF
If rsTable!WanNo = GBLWanNo And rsTable!IID = rs.Fields("IID") And rs.Fields("ForCoverSheet").Value = True Then
rsTable.Delete
DeleteCt = DeleteCt + 1
End If
rsTable.MoveNext
Loop
rsTable.Close
Set rs = Nothing