populate chart category from a combobox - Page 2


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Page 2 of 2 FirstFirst 12
Results 16 to 28 of 28

Thread: populate chart category from a combobox

  1. #16
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    If that doesn't work, maybe it would help if you post a few sample records from your database and describe what you want the returned data to look like.
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  2. #17
    Join Date
    Sep 2005
    Posts
    106
    thanks for the effort. I tried your code and it still gets a blank chart although with a breakpoint it shows 2 records for February.

    It's about the same result with this line...
    Code:
    cmd.CommandText = "SELECT '" & cboCategory.Text & "' FROM tbliface & " ORDER BY [Weeks]"
    It seems there is an issue with displaying these records but I'm using the same code to display at form load and displaying a recordset within a date range.
    Code:
        rs.CursorLocation = adUseClient
        rs.Open cmd, , adOpenStatic, adLockBatchOptimistic
        
        If rs.RecordCount = 0 Then
            MsgBox "The category hasn't any available data"
        End If
        
        MSChart1.Width = 12000
        MSChart1.ShowLegend = True
        MSChart1.Title.VtFont.Size = 12
        MSChart1.Title = "Interface Weekly Defect Results"
        
        rs.MoveFirst
        Set MSChart1.DataSource = rs
        MSChart1.Refresh
    question... there isn't a problem with only using one recordset?
    I've used rs for about everything.
    Last edited by RipIT; 02-20-2008 at 12:18 PM.

  3. #18
    Join Date
    Sep 2005
    Posts
    106
    The fields in my db are...
    Weeks, Analyzer, Humphrey, Accumulator, Pump, Regulator, Card, NDF,Solenoid
    These are the same selections given in the category combobox minus the Weeks
    With this category routine I want to display all the records for one category selection ordered by the weeks field. Currently at startup it shows all these categories ordered by weeks. I was wanting to break it down a little further and display by individual categories. Hopefully that makes sense.

    Steve

  4. #19
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    As a test, take out cboCategory and hard code something for Weeks = and hard code a field name.
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  5. #20
    Join Date
    Sep 2005
    Posts
    106
    This works...
    Code:
    cmd.CommandText = "Select Analyzer From tbliface"
    and this works
    Code:
    cmd.CommandText = "Select Analyzer From tbliface Order By [Weeks]"
    It displays all the data for a category I hard coded. It doesn't show the weeks just the R1...R7 along the bottom

    but this doesn't work
    Code:
    cmd.CommandText = "Select '" & cboCategory.Text & "' From tbliface Order By [Weeks]"
    Last edited by RipIT; 02-20-2008 at 01:00 PM.

  6. #21
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    Add a WHERE clause for a specific time frame.
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  7. #22
    Join Date
    Sep 2005
    Posts
    106
    this statement works...
    Code:
    cmd.CommandText = "Select Analyzer From tbliface WHERE [Weeks] BETWEEN #2/1/2008# AND #2/29/2008#"
    maybe I'll have to provide a time frame each time it is ran.
    Choosing from the cboCategory has been nothing but problematic.

  8. #23
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    Ok, good. Save that. Just comment it out so it doesn't run.

    Now, but your original statement using cboCatgory back in, but do this
    Code:
    Dim sSQL As String
    sSQL = "SELECT blab lbla where blahj balh 'your originial query
    Debug.Print sSQL
    Open the Immediate window and compare where is there to what you know works.
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  9. #24
    Join Date
    Sep 2005
    Posts
    106
    this works...
    Code:
    sSQL = "Select Analyzer From tbliface"
    I'm not really concerned about the date aspect of this.
    But would like to choose from a dropdown of categories.
    For some reason this isn't working...
    Code:
    sSQL = "SELECT '" & cboCategory.Text & "' From tbliface"
    The culprit seems to be selecting from the combobox
    In the immediate window it shows "SELECT 'NDF' From tbliface" that is correct
    but it seems to not want to display it.

    No errors come up just a blank chart
    Last edited by RipIT; 02-20-2008 at 04:20 PM.

  10. #25
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Try removing the single quotes:
    sSQL = "SELECT " & cboCategory.Text & " From tbliface"
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  11. #26
    Join Date
    Sep 2005
    Posts
    106
    Yes, yes, yes, it works!
    thanks Phil you are a Genius!
    You and Hack have been an enormous help!

    This puts weeks along the bottom, the dates that is.
    Code:
    sSQL = "SELECT [Weeks], " & cboCategory.Text & " From tbliface"
    Last edited by RipIT; 02-20-2008 at 04:51 PM.

  12. #27
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    So, is this completely resolved for you now?
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  13. #28
    Join Date
    Sep 2005
    Posts
    106
    Yes, this is completely resolved
    and with many thanks!

    Steve

Similar Threads

  1. Replies: 6
    Last Post: 09-06-2013, 04:44 AM
  2. VS2005 combobox and databinding issues
    By subrama6 in forum .NET
    Replies: 4
    Last Post: 02-13-2008, 10:19 AM
  3. Replies: 1
    Last Post: 08-28-2006, 07:51 PM
  4. msChart don't display xY chart
    By joni in forum VB Classic
    Replies: 0
    Last Post: 07-13-2000, 06:19 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
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center