AxLstPik

Originally supplied as a sample with the VB5CCE (Control Creation Edition) but with modifications.

Re-sizing. (The original was fixed size).

I Have also added two new properties.
DestinationListListCount
SourceListListCount

The control consists of two list boxes and the 'transfer buttons' as well as sorting buttons for the destination list to more single items up or down. Just plonk it on your form, instant 'Builder Wizard' style interface.

The control also supports two noteworthy events. The MoveToDestination and MoveToSource as shown in the code below
Also shown is an example of loading the list from a recordset (as you can see it's as simple as using the additem method) and opening a report based on the items in the destination list (via a temp table).The lists can be set to sort automatically as they are filled (Alpha).
Play around and use the 'Object Browser' to figure out the other properties and methods.

Option Compare Database
Option Explicit


Private Sub ActiveXCtl3_MoveToDestination(Cancel As Boolean, Count As Integer)

End Sub

Private Sub ActiveXCtl3_MoveToSource(Cancel As Boolean, Count As Integer)

End Sub

Private Sub CmdReport_Click()
  Dim rst As DAO.Recordset
  Dim lp As AXListPicker
  Dim i As Integer, Criteria As String
  Set lp = Me.ActiveXCtl3.Object
  Set rst = CurrentDb().OpenRecordset("temp")

  For i = 0 To lp.DestinationListListCount - 1
    rst.AddNew
    rst!PartNumber = lp.DestinationList(i)
    rst.Update
  Next
  
  cCriteria = "[PartNumber]In (Select PartNumber From Temp;)"
  DoCmd.OpenReport "Inventory", acViewPreview, , Criteria
End Sub

Private Sub Form_Load()
  Dim rst As DAO.Recordset, lp As AXListPicker
  Set lp = Me.ActiveXCtl3.Object
  Set rst = CurrentDb().OpenRecordset( _
  "SELECT PartNumber FROM Inventory WHERE Inventory.[Stk Grp]='R38'")
  Do While Not rst.EOF
    lp.AddItem rst!PartNumber, lspSourceList
    rst.MoveNext
  Loop
End Sub
Download Control...... AXLstPik
Download Sample Database...axlstpik.mdb
How to Register your Active-X library in the system registry using Access

Totally unsupported by Microsoft® Corp.

Freeware.

Use this Library at your own discretion.

Report
Faults to info@papwalker.com