Move data between listboxes?

Gasman

Enthusiastic Amateur
Local time
Today, 17:06
Joined
Sep 21, 2011
Messages
16,555
Good morning everyone,

I am attempting to create a system that will produce letters via a report.

My idea is to have various paragraphs as records, the actual text of the paragraph in a memo field.

I want to be able to show the relevant paragraphs for a type of letter and allow the user to select them via a listbox, much the same as the Access wizards do.

I’ve found code to move items but having problems with my setup?

lstAvailable will be populated from a table with fields

Code:
ID			Long
Order			Integer
ParagraphText		Memo

lstSelected would be the same

Now the code I have at present only copies the ID to the lstSelected, when I want all three fields to be copied (or so I believe).
At the same time I want to remove the selected item from the lstAvailable, so it cannot be selected again.
Conversely I will need to do the opposite, remove an entry from lstSelected and put it back into lstAvailable.

I will also need to sort lstAvailable when that happens and I have found code for that.

My problem is that Access states that I must use Value list to use the RemoveItem method, but I need to get my data from the table?

How can I accomplish this please?

I’ve attached a database where I have been trying out the code.
The form is Form1.

TIA
 

Attachments

Have a look at the attached database it does exactly what you're looking for.
 

Attachments

Have a look at the attached database it does exactly what you're looking for.

Thank you JHB,

I suspect you created that from scratch just for me. Much appreciated.:cool:
How would I handle this if more than one user was creating letters?
At present it will be only one, but I can see that more users would likely use it in the future?
 
..
How would I handle this if more than one user was creating letters?
At present it will be only one, but I can see that more users would likely use it in the future?
I suppose you're using a spilt database with a front end on each users computer, so what about keep it in a local table?
Else you need to explain it in more details with some samples.
No - I collect some (many) databases with sample code, just for cases like yours, then the questions pops up now and then.
 
I suppose you're using a spilt database with a front end on each users computer, so what about keep it in a local table?
No not yet, still in development, and early days, but yes, that is the way I will go.

Else you need to explain it in more details with some samples.
I am still in the process of creating tables etc, just trying to think ahead on how it will all work.

No - I collect some (many) databases with sample code, just for cases like yours, then the questions pops up now and then.

Still, thank you for digging it out from all the code you have.
 
Here is a link to Datapig, an older set of Access videos, that shows and explains a technique to move things between 2 listboxes. Similar to JHB, but with all steps described.

Datapig has several useful videos.

Good luck.
 

Users who are viewing this thread

Back
Top Bottom