Results 1 to 3 of 3

Thread: Chart in Access

  1. #1
    Join Date
    Apr 2002
    Posts
    168

    Unanswered: Chart in Access

    I create a chart in access and put SQL statement in the row source. I also have a combo box. What I want to do is when I change the combo box value, the chart is also updated (the combo box value will be in where statement).


    The code I am having right now is like this :


    select A,B from table_1;



    Can I do this:

    select A,B from table_1 where C = [my_combo_box].value;



    If instead of combo box, I have a list box (multiple selection), I can only change the SQL in VBA by going through each selection and rewrite the row source ?




    Thanks

  2. #2
    Join Date
    Sep 2002
    Location
    Land of OZ
    Posts
    173

    Re: Chart in Access

    Originally posted by milan
    I create a chart in access and put SQL statement in the row source. I also have a combo box. What I want to do is when I change the combo box value, the chart is also updated (the combo box value will be in where statement).


    The code I am having right now is like this :


    select A,B from table_1;



    Can I do this:

    select A,B from table_1 where C = [my_combo_box].value;



    If instead of combo box, I have a list box (multiple selection), I can only change the SQL in VBA by going through each selection and rewrite the row source ?




    Thanks

    Hi Milan,

    Yes you can do this ....
    select A,B from table_1 where C = [my_combo_box].value on update of the combobox.
    You will also need to requery the chart

    For a listbox, you will need to first build a string for the criteria by looping through the listbox. Once you have completed the looping, then build the row source. Don't rewrite the row source for each selection.

    Cheers
    Mona
    Mona
    ________________________________
    Life is too short to be sane or sensible. Weird people rule and normal people suck

  3. #3
    Join Date
    Apr 2002
    Posts
    168
    Thanks Mona.

    Just to make sure I understand what you mean, the SQL statement is put in the row source of the chart. And, put mychart.requery in the On Update event in the combo box. Is that correct ?


    Yes, that's what I meant.

Posting Permissions

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