Hi. You will need to loop through each of the values selected from your listbox and use a suitable SQL INSERT statement generated in code to insert them one by one into the table concerned. You tell us too little to give you much that will help you with this task, but the following skeleton may give you some ideas:
- Dim ctl as Control
-
Dim varItm as Variant
-
Dim strSQL as String
-
Set ctl = Me![name of your listbox]
-
For Each varItm In ctl.ItemsSelected
-
strSQL = "INSERT INTO [your table name] ([your field name 1]) "
-
strSQL = strSQL & " VALUES " & ctl.ItemData(varItm) & ";"
-
CurrentDb.Execute strSQL
-
Next varItm
You may find that you need to give all of this much more thought. I see little value in inserting single values like this into new rows in a table (assuming that you are not violating key contraints by doing so), but without knowing more details all I can do is answer the question you have actually asked, not the ones I think you should have asked.
Maybe you really mean you want to update existing rows, in which case you would use an UPDATE statement in place of the INSERT, but you would have to have suitable selection criteria to update the correct records. Anyway, you don't tell us, and there is simply not enough detail in what you ask to advise you further.
-Stewart