Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Moving Items between 2 listboxes 2

Status
Not open for further replies.

Cads

Technical User
Jan 17, 2000
40
GB
I want to move items between 2 adjacent listboxes in a way that is common in many Microsoft applications with right-to-left and left-to right buttons.

If I use Visual Basic 6 I can perform this quite easily with the .AddItem and .RemoveItem listbox properties (with some help from Francesco Balena's &quot;Programming VB6&quot; book). However, Access 97's listbox doesn't have these and I can't find an easy way of doing it. (I can do what Cantor [&quot;Listbox to another Listbox&quot; - 1 Aug] can do but not achieve the flexibilty I can get in VB6. Has anyone achieved what I want? All responses greatly welcomed! [sig]<p>Steve House<br><a href=mailto:shouse@icaew.co.uk>shouse@icaew.co.uk</a><br><a href= Inst of Chartered Accts of England & Wales</a><br> [/sig]
 
Steve, check you email. I sent you an example that will show you how this can be done.

HTH :)
RDH [sig]<p>Ricky Hicks<br><a href=mailto: rdhicks@mindspring.com> rdhicks@mindspring.com</a><br><a href= > </a><br> [/sig]
 
I'm having the same EXACT problem. I too have no problem adding data from one listbox to another in VB6, but in Access, I can't seem to find the right property.

Brad B
 
If you can, you might be iterested in using the Microsoft Forms 2.0 Listbox control. It is an ActiveX control, but it works like the VB listbox and you don't have to do the unwieldy routines to transfer things from one Access Listbox to another. You must make a reference to the Fm20.dll to get at the controls. I use the combo box as well. When you reference these objects in your code explicitly declare them.

For instance

Private Sub AddSomething()
Dim ctl As MSForms.ListBox

'Then set the form's Control to it
Set ctl = Me.MyListbox.Object

Then you will have access to all of the Properties, Methods and Events of the Listbox Class.

Try it, I think you'll find it works just fine.

BB

 
rbowes,
Excellent! It was EXACTLY what I was looking for. It's great that I can access all of the Properties, Methods and Events.

Brad B

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top