I have a table named Tbl_Temp_PP_Edit_Name and a list box named List_Edit_Name I would like to take the items selected in the list box and add it to the table. Below is the code I have tried but it failed saying Sub or Function not defined. Can someone help?
Code:
Private Sub Command6_Click()
Dim rst As Recordset
Set rst = CurrentDb.OpenRecordset("Tbl_Temp_PP_Edit_Name", dbOpenDynaset)
row = List_Edit_Name.ListIndex
For Each row In List_Edit_Name.ItemsSelected
PP_EDIT = List_Edit_Name.Column(0, row)
With rst
.AddNew
.Fields("PP_Edit_Name") = PP_EDIT
Update
End With
Next row
rst.Close
Set rst = Nothing
End Sub