Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 31
  1. #16
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Did you try as suggested in my earlier 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.

  2. #17
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,977
    @JonathanT
    How about this?

    Click image for larger version. 

Name:	ComboChart.PNG 
Views:	29 
Size:	32.1 KB 
ID:	50536

    As you can see, I've used a combo modern chart to do this
    The column chart data is in one table and the fixed line in a separate table which I've combined in a cartesian query

    Attached is your database with this modification
    Attached Files Attached Files
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  3. #18
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,977
    In fact it can be done without a second table or caertesian query. Instead use a TempVar.

    Change the CholesterolQry SQL to
    Code:
    SELECT BloodData.CurrDate, BloodData.CholesterolTotal, BloodData.HDLCholesterol, BloodData.[LDL Cholesteral], CInt([TempVars]![RefLine]) AS RefLine FROM BloodData;
    I've removed the unnecessary grouping

    Then use this code in the Form_Load event of the form containing the chart:
    Code:
    Private Sub Form_Load()  
         TempVars!RefLine = 200
    End Sub
    This sets the value for use by the chart. QED!
    Attached Files Attached Files
    Last edited by isladogs; 07-27-2023 at 12:01 AM.
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  4. #19
    JonathanT is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2011
    Posts
    118
    I have solved my problem. I added fields in the table that indicates the value of each reference range and the the value is the same for every record. I added that field to the query for the chart. This gives me a straight line to reference the results of each chart. In Chart Settings I edited the Display Name to show the value the line represents. I've attached the updated DB

    BloodTestsUpdate.zip

  5. #20
    JonathanT is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2011
    Posts
    118
    Isladogs, I saw your post after I had come up with another solution. Your option does provide what I was looking for. I'll try your option and see how it works. Thanks for the input

  6. #21
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,977
    Your solution should work but both of my alternatives should achieve the same result with less effort. No need to add multiple values that are identical

  7. #22
    JonathanT is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2011
    Posts
    118
    isladogs, I tried your solution and it is much more efficient than mine. I will continue to use it. Thanks!

  8. #23
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,977
    Excellent.
    I'll write a short web article explaining this approach and reference this thread
    Out of interest, which of the two methods did you use?
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  9. #24
    JonathanT is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2011
    Posts
    118
    I used the TempVar solution

  10. #25
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,977
    Thanks. Is it OK with you if I use your data and this chart in the web article?
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  11. #26
    JonathanT is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2011
    Posts
    118
    Yes, that is OK. There is nothing personal or proprietary in the DB.

  12. #27
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,977
    Thanks for letting me know. I may write that page tomorrow or Friday
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  13. #28
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,977
    Web article now published: Using Combo Charts in Access

    Thanks for asking the question and allowing me to use your data
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  14. #29
    JonathanT is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2011
    Posts
    118
    I have one more question regarding the reference line on the chart. Some of the values for the reference line are in tenths, such a 5.7 or 3.2. I set those values for the TempVars in the OnLoad section of the form. However when I run the query for the reference line the values always round either up or down to a whole number. Anyway to get the reference line to show as the exact value shown for the TempVars? I tried formatting the query field with Fixed or Standard and there was no change

  15. #30
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,977
    The query I provided cast that as an integer: CInt([TempVars]![RefLine]) AS RefLine for reasons i didn't originally explain in the article

    Remove that and replace with e.g. Round([TempVars]![RefLine], 1) AS RefLine where 1 = number of decimal places required.

    NOTE: Due to an Access bug, you MUST cast or format the TempVar field in the query.
    You can't just use [TempVars]![RefLine] in the query as that will produce gibberish:

    Click image for larger version. 

Name:	UnformattedTempVar.PNG 
Views:	12 
Size:	31.9 KB 
ID:	50600

    I've just added a comment to that effect in the web article
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

Page 2 of 3 FirstFirst 123 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. MSGraph Chart.8 Line - Column
    By bmk450 in forum Reports
    Replies: 0
    Last Post: 03-11-2020, 09:19 AM
  2. line chart on report
    By BobW2961 in forum Reports
    Replies: 2
    Last Post: 08-15-2018, 11:38 AM
  3. line chart not showing lines
    By ajetrumpet in forum Reports
    Replies: 0
    Last Post: 09-11-2010, 05:55 PM
  4. Replies: 2
    Last Post: 07-12-2010, 05:39 AM
  5. Line-Bar Chart Issue
    By santoshpk in forum Reports
    Replies: 0
    Last Post: 03-17-2009, 02:47 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