Results 1 to 2 of 2

Thread: listbox problem

  1. #1
    Join Date
    Dec 2003
    Posts
    49

    Unanswered: listbox problem

    i have a form that consist of 2 listbox
    the 1st listbox is populated with productname from product table
    the 2nd is empty.
    user drag and drop productname from the 1st listbox to the 2nd listbox. (it's up to them
    how many records in the 2nd listbox)
    then the user click a commandbutton that generates a report that consist of the product
    listed only in the 2nd listbox.

    i've understand how to populate the 2nd listbox with drag and drop method.
    the problem is how to pass the parameter from the 2nd listbox to the criteria of the
    docmd.openreport method.

    thank you
    hendra gunadi

  2. #2
    Join Date
    Oct 2003
    Location
    Roanoke, Va
    Posts
    445

    Smile Re: listbox problem

    Originally posted by hendra1211
    i have a form that consist of 2 listbox
    the 1st listbox is populated with productname from product table
    the 2nd is empty.
    user drag and drop productname from the 1st listbox to the 2nd listbox. (it's up to them
    how many records in the 2nd listbox)
    then the user click a commandbutton that generates a report that consist of the product
    listed only in the 2nd listbox.

    i've understand how to populate the 2nd listbox with drag and drop method.
    the problem is how to pass the parameter from the 2nd listbox to the criteria of the
    docmd.openreport method.

    thank you
    Since the 2nd listbox contains only items you want to have in the report, you can loop through the items and create a where clause for the OpenReport method. This is one way you can gain access to the items.

    Private Sub Command45_Click()

    Dim lst As ListBox, x As Integer
    Set lst = Me.lst1

    For x = 0 To lst.ListCount - 1

    Debug.Print lst.Column(0, x)

    Next

    End Sub
    Gregg


    DAO, ADO, SQL, Automation and anything else I can pick up.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •