Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Feb 2004
    Location
    Burgas, Bulgaria
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts

    open report for selected products (Access 2000)

    I have a list box with the name of the product with the row source :


    SELECT products.Productid, products.grade, products.size FROM products;
    I want to open the report RptProducts for the products i have clicked on the list.For example i have clicked on three products.I want to open the report for these three products only.What kind of code could i place in the OnClick event so that to remember the products i have chosen ?

  2. #2
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Vancouver, Br. Columbia, Canada
    Posts
    632
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: open report for selected products (Access 2000)

    I have always found that working with selected items in a list control is awkward -- it involves looping through the items of the list and checking the ItemSelected (???) property. Then you are faced with the problem of communicating with the report. Here's what I would do instead:

    add a Selected (Yes/No) field to the Product table
    replace the listbox with a subform that shows the product name and the Selected field
    check on or off the items to be included in the report

    Then create a new query that includes the ProductID and the Selected field. Set the criteria to Selected=TRUE Save this query as qryProductsSelected
    Modify the recordsource of your report by joining the qryProductsSelected query to the original Product table.

    As you check on and off the various products, the report should react accordingly. That should do it!

    It's more complex in a multi-user environment because several people may vie for the Selected field at the same time. In that case, I would add a new table to the FRONTEND of the application, containing the ProductID and the Selected field. This strategy provides each user with a local instance of the Selected field. Create a Unique index on ProductID. Populate the table with all the ProductID's from the main Product table.
    --------------------------------------------------
    Jack MacDonald
    Vancouver, Canada

  3. #3
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: open report for selected products (Access 2000

    Check out my example...it's fairly straightforward, and could possibly help you as well <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

    I'd like to direct you to <post:=546,295>post 546,295</post:>. This seems to be an identical question. Let's pick one or the other to carry this on in. Thanks!
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What&#39;s more, you deserve to be hacked." -Richard Clarke

  4. #4
    3 Star Lounger
    Join Date
    Feb 2004
    Location
    Burgas, Bulgaria
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: open report for selected products (Access 2000)

    I am applying the attchement i have missed to attach.I cannot understand is it possible to open a report on the basis of the items selected? tAnd can i save the items selected ?he code is a bit incomprehensible to me.Actually i have received a suggestion by NYIntensity which perfectly suits me.

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: open report for selected products (Access 2000)

    There's no point in having two threads about the same problem. This one is locked. Please post further replies in the other one (starting at <post:=546,295>post 546,295</post:>).

Posting Permissions

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