Link to home
Start Free TrialLog in
Avatar of D J
D JFlag for United States of America

asked on

MS Access How can I convert this code from inserting to delete records?

MS Access How can I convert this code from inserting to delete records?

Private Sub Command0_Click()
On Error Resume Next
Dim varList1 As Variant, varList3 As Variant
Dim strSQL As String

For Each varList1 In Me.List1.ItemsSelected

    For Each varlist2 In Me.List3.ItemsSelected

        strSQL = "INSERT INTO tbl_Join_Proj_Cust (CustID, DeviceID) " _
               & "Values (" & Me.List1.ItemData(varList1) & ", " _
                            & Me.List3.ItemData(varlist2) & ")"
        CurrentDb.Execute strSQL, dbFailOnError

    Next varlist2

Next varList1



End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of John Tsioumpris
John Tsioumpris
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of D J

ASKER

Thanks John!
Glad to help you.