Select from list box and enter selection in a table.

G

Guest

I have 3 tables lead table, countysend and countylist table. One lead can be sent to many counties. User's enter the lead information and then they have to select which counties they would like to send it to. I created a list box on a form which is a button on the main form called "Select Counties". The list box is populated by the countylist table. When user's select the multiple counties from the list box they hit another button called "OK" by clicking "OK"it should enter a record for every county selected in the list box for that leadID in the countysend table and then return to the main form. On the main form I have a subform that will list all of the counties selected. I also need a Statewide option which is basically "all" counties on the list which will add 67 records.

Exampl

LeadId Count
12 Orang
12 Ba
12 Volusia
 
G

Guest

What is the question

Yes, it can be done fairly easily. You need 'multiselect' turned on for the listbox. Then in the onclick event procedure for your 'add' button, you loop thru the listbox and for each selected entry add records to the tables you need, you can run an sql INSERT to do the add
The code for looping through the listbox entries can be found in Access HELP as can the code for doing an INSERT.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top