Page 1 of 2 12 LastLast
Results 1 to 15 of 21
  1. #1
    titiakila is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2021
    Posts
    22

    link a graph to a drop-down list

    Hello everyone,

    I want to display the values in a graph for the categorie "Histogramme 1" for example by choosing the categorie in the scroll-down list.



    How can I do that ?

    I will put the image in the comments

    Thank you very much.

  2. #2
    titiakila is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2021
    Posts
    22
    I cant put an image.
    I want to display the amount of sales by year for example but choosing for which product by choosing the product in a list
    Attached Thumbnails Attached Thumbnails Captureaccess.PNG  

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    A graph RowSource can reference a control in WHERE clause, example:

    SELECT M, D, FD, ZD, ZDM FROM GraphProctor WHERE LabNum=[tbxLabNum];

    Post your graph RowSource if you need more help.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    titiakila is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2021
    Posts
    22
    I tried to put a where condition in the source query of the graph but I add an error
    "the database engine does not recognize the list name as a correct name or expression"

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    As I said, provide RowSource if you need more help.

    If you want to provide db, follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    titiakila is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2021
    Posts
    22
    I'm sorry i cant provide my original db so i tried with a test one. I just found out how to upload it it's bellow in my last post. But I only want to know if there is a solution for my problem. I want to know what vba code should I put when the event change the selection on the list happend. Sorry I'm french I don't understand everything in english. Thank you in advance.

  7. #7
    titiakila is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2021
    Posts
    22
    Click image for larger version. 

Name:	Capture.PNG 
Views:	18 
Size:	44.8 KB 
ID:	46065
    the test data

  8. #8
    titiakila is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2021
    Posts
    22
    Click image for larger version. 

Name:	Capture2.PNG 
Views:	17 
Size:	20.1 KB 
ID:	46067
    the graph I want to make an action on
    Attached Thumbnails Attached Thumbnails Capture1.PNG  

  9. #9
    titiakila is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2021
    Posts
    22
    db.zip
    my test database

  10. #10
    CarlettoFed is offline Competent Performer
    Windows 7 64bit Access 2013 32bit
    Join Date
    Dec 2019
    Posts
    274
    In the attachment you can see an example to get what you want.
    DB.zip

  11. #11
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Use this SQL as graph RowSource:

    PARAMETERS [Modifiable0] Text ( 255 );
    TRANSFORM Sum(Requête1.sales) AS SommeDesales
    SELECT Requête1.year_sale FROM Requête1
    WHERE (((Requête1.product)=[Modifiable0]))
    GROUP BY Requête1.year_sale
    PIVOT Requête1.product;
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  12. #12
    titiakila is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2021
    Posts
    22
    Thank you very much. Unfortunatly I cant download this database frome work.
    I tried the sql query you wrote and to put it as the source of my graph and I have the following error message :
    the selected query does not contain enough data to create a chart or the fields cannot be extracted. select a table or query containing at least one numeric date or text field

  13. #13
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,556
    Here is the SQL from CarlettoFred's DB
    Code:
    SELECT tblSales.YearSale, tblProducts.IDProduct, tblProducts.Product, tblSales.Sales
    FROM tblProducts INNER JOIN tblSales ON tblProducts.IDProduct = tblSales.IDProduct
    ORDER BY tblSales.YearSale, tblProducts.Product;
    Rowsource for graph is
    Code:
    TRANSFORM Sum(qrySaleProducts.Sales) AS SommeDesales SELECT qrySaleProducts.YearSale FROM qrySaleProducts GROUP BY qrySaleProducts.YearSale PIVOT qrySaleProducts.Product;
    HTH
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  14. #14
    titiakila is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2021
    Posts
    22
    Just to be sure the rowsource is a query you select when you make the graph ?
    Thank you very much.

  15. #15
    titiakila is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2021
    Posts
    22
    And in the code you wrote I don't see the where condition to select the value from the list is that normal ?

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 6
    Last Post: 03-27-2020, 01:53 PM
  2. Replies: 4
    Last Post: 06-16-2011, 09:30 PM
  3. Replies: 3
    Last Post: 01-10-2011, 10:31 AM
  4. Replies: 5
    Last Post: 08-11-2010, 09:16 AM
  5. Drop Down, link to another dropdown
    By davelliott in forum Forms
    Replies: 3
    Last Post: 05-23-2006, 08:05 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums