Need help with allowing duplicate selection for transferring listboxes

Banana

split with a cherry atop.
Local time
Today, 13:41
Joined
Sep 1, 2005
Messages
6,279
I found this sample which allows you to move your selections from one listbox to another with four buttons (<<, <, > and >>) which is just perfect.

Well, almost, actually.

This is already set up to protect against duplicates and that's a good thing. However in my case, my uppers want me to allow duplicates. The code is beyond my ability and my attempts only caused more problems.

The code requires a unique index be generated when the selection is moved between the listbox. Duplicating the index will cause error, and my attempt to circumvent that has either failed totally or is inconsistent (e.g. works if it comes up with a unique value, but will fail if it happens to duplicate a key).

Can anyone show me how I can modify the code to allow for duplicates? The selections then will be looped into a many side table.
 
This example is how I set up a report for a client that allowed them to get running sums on the job totals before the total job was finished. It has code that will stop transferring an entry twice, but I have commented out these 3 lines.

HTH

Dave
 

Attachments

Ahh, much more simpler than the first sample. I like.

Thanks, Dave! :)
 
The good thing about this sample is that it writes the results from the first listbox to a table, which the second listbox is based on, then requeries the 2nd listbox. This means making a report etc based on your selection(s) is very easy.
 
Yeah, I really liked it.

Oh, and thought you would like to know-

I noticed quirky behavior when moving between records, so to keep listbox updated, I replaced all "lstName.Requery" to "Call SelectionQuery" where I re-run the SQL string or set rowsource to "" if no ID in both current event and afterupdate of the ID bound field. That helped with keeping listbox current.

Again, thanks! :)
 
Thank you very much . i find it for long time.
i saw it ^_^
 

Users who are viewing this thread

Back
Top Bottom