Review http://office.microsoft.com/en-us/ac...010341717.aspx
Also, review the link on debugging at bottom of my post.
Not sure what the code you show is supposed to do but it is not saving records. I have given you reference to example code that can be adapted to your situation as well as the code needed to save record. The boxes would be unbound.
I don't know your db so can't give specifics but something like:
Code:
'Loop through the ItemsSelected in the list box.
With Me.lstCategory
For Each varItem In .ItemsSelected
If Not IsNull(varItem) Then
CurrentDb.Execute "INSERT INTO tablename(fieldname) VALUES('" & .Column(1, varItem) & "')"
End If
Next
End With
Are these listboxes on form that is bound to the table you want the listbox selections saved to? As stated, really don't know enough about your db.
I never use them, but maybe what you really want is a multi-value field. http://office.microsoft.com/en-us/ac...001233722.aspx
Another consideration is instead of multi-select listboxes, maybe subform would serve this need.