Microsoft Access - Add all items from a listbox into a table without having to be selected?
<p>I'm making a data entry form that allows me to add new businesses and details for that business, before importing them into their respective tables. For the most part, I have completed it all.</p>

<p>However, there are some pieces of information that require more than one input. For example - a business could have multiple telephone numbers/documents/staff members etc.</p>

<p>I have set up a text box and an add/remove button which adds/removes the text in the textbox to a listbox. I want to be able to import all of the items in the listbox, without having to select them into a table. Is this possible? Most of the answers that I've found online require you to have the items selected.</p>

<p>An example piece of code that I have on the import button is show below. This code adds the address details of the business to the 'Business Address' table.</p>

<pre><code>'Set Table to 'Business Address' then add the fields to the table
Set RST = CurrentDb.OpenRecordset("Business Address", dbOpenTable)
RST.AddNew
RST![Business Name] = Me.txtBusinessName
RST![Address] = Me.txtAddress1 &amp; ", " &amp; Me.txtAddress2
RST![Town/City] = Me.txtTownCity
RST![Postal Code] = Me.txtPostalCode
RST.Update
RST.Close
</code></pre>

<p>I was thinking some sort of for loop to add all items in the listbox to a table?</p>

<p>Logically speaking <strong>(This is not a real example of working code, just something I imagine this might look like if possible?):</strong></p>

<pre><code>Set RST = CurrentDb.OpernRecordset("Business Telephone", dbOpenTable)
For each item in TelephoneListBox
    Rst.AddNew
    Rst![Business Name] = Me.txtBusinessName
    Rst![Telephone] = Me.TelephoneListBox.Column(0)
</code></pre>

<p>I'm not sure how to go about it and if it can actually be done without the items being selected? Any ideas?</p>