Results 1 to 4 of 4

Thread: Coding graphs

  1. #1
    Join Date
    Aug 2002
    Location
    Charlotte NC
    Posts
    665

    Unanswered: Coding graphs

    Has any one ever coded a graph in vba? This is my code:
    Country_To_Country.RowSourceType = "Table/Query"
    Country_To_Country.RowSource = "SELECT [R_Country] & ' - ' & [D_Country] AS Country_Pairs, Sum(Table_PCRKMS_Local_Data.FFE) AS FFE FROM Table_PCRKMS_Local_Data GROUP BY [R_Country] & ' - ' & [D_Country]ORDER BY Sum(Table_PCRKMS_Local_Data.FFE) DESC;"

    This doesnt error out but it also doesnt display a graph.
    Has any one ever done this before and/or does anyone have any suggestions?

    Regards
    Jim

  2. #2
    Join Date
    Aug 2002
    Location
    Charlotte NC
    Posts
    665

    Re: Coding graphs

    Originally posted by JDionne
    Has any one ever coded a graph in vba? This is my code:
    Country_To_Country.RowSourceType = "Table/Query"
    Country_To_Country.RowSource = "SELECT [R_Country] & ' - ' & [D_Country] AS Country_Pairs, Sum(Table_PCRKMS_Local_Data.FFE) AS FFE FROM Table_PCRKMS_Local_Data GROUP BY [R_Country] & ' - ' & [D_Country]ORDER BY Sum(Table_PCRKMS_Local_Data.FFE) DESC;"

    This doesnt error out but it also doesnt display a graph.
    Has any one ever done this before and/or does anyone have any suggestions?

    Regards
    Jim
    Ok I got that problem fixed, now a new one
    my code:
    Dim Cur_DB As DAO.Database
    Dim Record_Set As DAO.Recordset

    Country_To_Country.RowSourceType = "Table/Query"
    Set Cur_DB = CurrentDb()
    Set Record_Set = Cur_DB.OpenRecordset("SELECT [R_Country] & ' - ' & [D_Country] AS Country_Pairs, Sum(Table_PCRKMS_Local_Data.FFE) AS FFE FROM Table_PCRKMS_Local_Data GROUP BY [R_Country] & ' - ' & [D_Country]ORDER BY Sum(Table_PCRKMS_Local_Data.FFE) DESC;", dbOpenDynaset)
    Country_To_Country.RowSource = Record_Set(?)

    Here I am trying to use a record set as the source of the graph but im not sure how to use the record set.
    Any suggestions?
    Jim

  3. #3
    Join Date
    Jan 2003
    Location
    UK
    Posts
    5
    I've only used your original method of creating a SQL statement and setting the Rowsource property with it.

    Have you tried putting in your case a Country_To_Country.Requery line after setting the parameter in your code, in order to refresh/recalculate the graph object?

  4. #4
    Join Date
    Aug 2002
    Location
    Charlotte NC
    Posts
    665
    Originally posted by mccread
    I've only used your original method of creating a SQL statement and setting the Rowsource property with it.

    Have you tried putting in your case a Country_To_Country.Requery line after setting the parameter in your code, in order to refresh/recalculate the graph object?
    I should have posted a bit ago...sorry.
    The answer is not to use a recordset but a querydef
    that way I can then set the rowsource for the graph using the query, much easier.
    Thanx for your help
    Jim

Posting Permissions

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