I have a Multiselect Listbox with a "Form Load" code as follows:
Dim rst As New ADODB.Recordset
ListBox2.ListStyle = 1
ListBox2.MultiSelect = 1
ListBox2.ColumnCount = 3
ListBox2.ColumnWidths = "2 in;1 in;3 in"
ListBox2.Font.Name = "Calibri"
ListBox2.Font.Size = 11
rst.Open "SELECT [Org Employee Info from Maximo Table].[NAME], [Org Employee Info From Maximo Table].[Job Position] FROM [Org Employee Info from Maximo Table] ORDER BY [NAME]", CurrentProject.Connection, adOpenForwardOnly, adLockReadOnly
ListBox2.Column = rst.GetRows
rst.Close
Set rst = Nothing
I would like to know how to take the selected item (EMPLOYEE) to a table called "Class Requirement Table" and put in the EMPLOYEE field. I do not need the Job Position field brought to the table. I also need the "checkboxes" in the multiselect listbox to clear. I found this code however I am not sure if it will work. Please help!!!
Set ctl = Me.lstEmployees
For Each varItem In ctl.ItemsSelected
rs.AddNew
rs!EmpID = ctl.ItemData(varItem)
rs!OtherValue = Me.txtOtherValue
rs.Update
Next varItem