Multiple Listbox selections problem

Diversion

Dutch Databaser
Local time
Today, 23:31
Joined
Apr 13, 2005
Messages
16
Hi guys new here.

Here's what I'm trying to do:

I made a listbox in which get's it's source from a field in a table named Soft. The field is named Software1.

This field contains a list off software that could be installed on systems.
I allready can select multiple selections from the listbox but what I want to do is the following.

I want to press a button, and after I press the button I want that the selected Software is added to a new listbox which show the Software installed. The software in the second listbox would also be stored inside a Table so that I could print them out in Reports.

To simply explain what I'm trying to do:

SoftwareListbox >> Make multple selections>>Press button>> Adds selected software to InstalledListbox which stores in the softwarelist installed in a Table.

I really hope you guys understand what I'm trying to do.
And sorry for my bad english, should have paid better attention during English class ;)
 
Last edited:
Your English is better than that of many whose native language is English. No need to appologize.

You have a 1-many relationship that you are trying to store as a repeating group. The software needs to be stored in a separate table. You will also find it easier to work with if you use a subform for the software.

Take a look at any sample database that contains a form with a subform to see how a 1-many relationship works. Northwind and Orders has them as does the form sample available from the MS download site.
 
Thank you for replying and the compliment about my English :D

After you explained the 1 to many part it all got a lot more clear to me.
Think I could get a lot further in the development of my database now!

Thnx again!
 
At work again and trying to do what you told me last week.

This is what I did.
Put all the software in the table SOFT using the following structure:

SoftwareID
Software01​

1
Software1​
2
Software2​
3
Software3​
ect.

and put a subform in my form which leads to a form created from the Table SOFT which looks like this:
soft.jpg


it now looks like this when I look at my subform in the original form:
1tomany.jpg


If I now select a checkbox it will select all the checkboxes.So what I now want to do is be able to select the checkboxes one-by-one and make them correspond with the Software that is behind the checkbox so when I click the Button it will place the selected software to the other side.
 
If I now select a checkbox it will select all the checkboxes.
That is because the checkbox is unbound. The form retains only a single instance of its properties so they reflect only the value for the current record. When you check the box for the current record, all the visible rows show the same value.

I would not use this approach. You would have to actually add the "selected" column to the table so that it could persist and that in itself will lead to problems in a multi-user environment.

I would use a simple subform with a combo. I uploaded a picture of a user setup form with two subforms that are similar to what yours will look like. Basically each new row represents a piece of software that was selected from the combo.
 

Attachments

  • subformExample.jpg
    subformExample.jpg
    44.3 KB · Views: 209
Thnx again for the help!
Does every drop-downlist have it's own TableEntry?
and when I have done this how do I get it to get them in the installed software colum to the right with the click of a button?
 
I showed you an example that doesn't require any code to implement. If you want the effect of moving from one list to another, that requires coding. I've included a sample db that shows a couple of forms with listboxes. Take a look at the Reports form. This form works with lists in memory, nothing is saved to tables. You will want to modify the code so that your selections are saved.
 

Attachments

Implemented your example into my database and it works.
Now need to store what's I put in the new listbox into a Table.
How can I put them in a table?
I kept all the names as in the example you gave me.
 

Attachments

  • form.JPG
    form.JPG
    68.2 KB · Views: 173
Last edited:
Instead of adding the selections to a listBox control, add a real subform and add them to the table bound to the subform. If you want to stick with the two listBox controls, embed the code that adds a record to the table when the right pointing arrow is selected from the left box and delete it when the left pointing arrow is pressed.

Look up "AddNew DAO" and "Delete DAO" from help for code examples. You can use ADO if you are more comfortable with it but DAO is better if the tables are Jet.
 
As you can guess I only get to work on this for a couple off hours a week.
Tried to add a tblbatchreports and changed all the lstBatchlist to tblbatchlist but that didn't work(why can't it be that easy ;))

I know what your trying to explain to me but I can't get it to work.
Do you have any links to examples showing me how to do this?

Again I really appreciate your help so far.

Thank you,

Diversion
 
You can see how the subform works by opening virtually any of the sample and template databases that ship with Access. Open northwinds and look at the order entry form. The subform works the way yours should work.
 

Users who are viewing this thread

Back
Top Bottom