Results 1 to 8 of 8
  1. #1
    Lounger
    Join Date
    Sep 2007
    Posts
    45
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Adding Combo Boxes values (2003)

    I have 3 questions First off, I have 18 combo boxes, with a value list of 1;2;3;4;5;6;7;8;9;10, and a text box at the bottom of the form. I would like to have it sum the values of the combo boxes. Secondly, I would like to have a Yes/No combo box, but if Yes is selected, the total needs to add a 10 to it, and a No should add 0. Third, if I wanted to have the value from said text box transfer to another form, would a simple [forms]![formname]![textbox].[value] work?

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

    Re: Adding Combo Boxes values (2003)

    1) & 2) Set the control source of the text box to

    =Val([Combo01])+Val([Combo02])+...+Val([Combo18])-10*([ComboYesNo]="Yes")

    subsitituting the correct names, of course.

    3) An expression of the form

    =[FormName]![TextBoxName]

    will work, but only if the form FormName is open.

  3. #3
    Lounger
    Join Date
    Sep 2007
    Posts
    45
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Adding Combo Boxes values (2003)

    Thanks for the speedy reply. I have 2 more questions now, First off, if I use the Val(....., how do I get the form to write that value to the table? I am using the source control to add the values up.

    Secondly, I have a report with a chart on it, generated by a query. I would like to have the report be generated depending on the selection of a combo box, but everytime I use [Forms]![Formname]![ComboName].[Value], i get an error. Any ideas what I am doing wrong? I really don't want to make seperate reports and charts for 30 different areas.

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

    Re: Adding Combo Boxes values (2003)

    Since the result is a calculated value, you shouldn't store it in a table, that would be redundant. By calculating it on the fly, you know for certain that it is always up-to-date.

    Does it work better if you omit .[Value], i.e. if you use [Forms]![Formname]![ComboName] ?

  5. #5
    Lounger
    Join Date
    Sep 2007
    Posts
    45
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Adding Combo Boxes values (2003)

    ill try the omitting thing tomorrow at work.

    For the first question, what would you suggest? I can't log onto your site at my work, deemed "non work related' ..... (if they only knew...), so I can't post it either, but here's the low down.
    I have a list of 18 combo boxes, 16 have a value list of 1-10, and 2 are yes/no. The yes values are weighted with certain values, one is 30, and the other is 2. What I need to do is total them all up, at the bottom of the form, and put that into a table, along with the values of each combo box. Any ideas?

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

    Re: Adding Combo Boxes values (2003)

    Once again, there is no need to store (weighted) sums in a table. You can calculate them 'live' when they are needed.

  7. #7
    Lounger
    Join Date
    Sep 2007
    Posts
    45
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Adding Combo Boxes values (2003)

    Thanks for the help Hans. I tried to remove the [value] from the [Forms]![formname]![combobox], but it still doesnt work. It gets a "Microsoft Jet Engine Error" Says something about an invalid expression. Any ideas?

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

    Re: Adding Combo Boxes values (2003)

    Could you post a stripped down copy of your database? See <post#=401925>post 401925</post#> for instructions.

Posting Permissions

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