Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check box to delete subform's records 1

Status
Not open for further replies.

qwerty70

Technical User
Dec 13, 2005
73
GB
Dear All,

My main form "frmRequestMaster" has a check box named "Demobilized" and once I click it I want my subform's (subIssue) records to be deleted.

Here's my code but I just can't make it work, please help.

Code:
Private Sub Demobilized_AfterUpdate()
    If Me.Demobilized = True Then
        Forms!frmRequestMaster!subIssue.Recordset = Null
    End If
End Sub

Any help is highly appreciated. Thanks.

Regards,

qwerty70
 
What is the SQL code of the RecordSource of subIssue ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
PHV,

RequestID in subIssue is linked to RequestID in the mainform.

Here's the RecordSource of subIssue:

Code:
SELECT [tblIssue].[RequestID], [tblIssue].[SerialNum], [tblIssue].[Brand], [tblIssue].[Model], [tblIssue].[Sticker], [tblIssue].[ID] FROM [tblIssue]

Thanks,

qwerty70
 
You may try something like this:
Code:
If Me!Demobilized = True Then
  DoCmd.RunSQL "DELETE FROM tblIssue WHERE RequestID='" & Me!RequestID & "'"
End If
If RequestID is defined as numeric in tblIssue then get rid of the single quotes.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
PHV, thanks. That worked perfect. My apology for late feedback, I was on leave.

I really appreciate your continuous support. A star for you.

Regards,

qwerty70
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top