Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2004
    Raleigh, NC

    Question Unanswered: Multiselect List Box and Total

    I want to create a multiselect list box that will be populated from 2 separate queries. The purpose of the box is fairly simple.. at least, in concept anyway. I have several products that I want to bill a customer for and the list box is a method by which to bill them for several products at once. I'm looking to be able to select several products from the box and programmatically have the total cost of each summed and placed in a text box control on the same form. This way, I can get a grand total for several products and only have to charge the customer once.

    I keep trying to create a list box with the wizard to accomplish this task, but I keep getting: "No value given for one or more required parameters." I've tried everything I could think of, but can't rid myself of this error.

    My questions are this:
    1. How can I get this list box created to begin with and get around this error? Any ideas?
    2. How can I combine the results of 2 queries into 1 "pool" so to speak that I can populate the list box with?
    3. How can I pass a value (the cost of the individual products) from the list box to a text box control? In other words, as the operator clicks on each item, the product costs are summed up and placed in a totals box.
    4. Once everything is said and done with the payment, I need to be able to set a Yes/No field to "YES" for each product that had been selected from the list box and ultimately, paid for. I can think of several ways to handle this with code, but I'm not sure how to make it interact with the list box. I've done some reading, but still not very familiar with how list boxes work.


  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    I don't think you can achieve waht you want with the wizards
    It is dooable, but the only way I can think of doing it involves populating the list box yourself

    the list box will need to be set to value list
    populate the list box in the forms on load event with the values from your queries. You will need to include something in the list box datastream to identify the original source. Transfer the items as usual using an on click event, using the identifier to recognise which query the data camne from originally. Obviouosly you could in effec use the datasource for the list box as if it were a query recordset (ie place all the columns you need in the listbox items - not a good idea if therte are many columns and many rows 0 but you know your data. The alternative is to then retrieve the information you need from the original data sources which will involve more code in the on click event.

  3. #3
    Join Date
    Apr 2004
    Derbyshire, UK
    Provided Answers: 2

    Just a thought, if you want to take the easy way (or don't like writing code if you don't have to) then why not use a Union query to stich the 2 queries together and use that as the list DataSource!?

    This can be done using stored queries or in with SQL statments in the load event.

    If the 2 queries are from different tables then you you would need to add a field to each query to identify which record/list item is from which table ie. 1 AS TableNo in one query and 2 AS TableNo in the other, then you will now which table to update with "Yes".



Posting Permissions

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