Solved

MSChart

Posted on 1998-05-03
11
701 Views
Last Modified: 2008-02-01
The first time we assign a two dimensional array to a MsChat1 to generate a chart the RowLabels are Months & the COlumnLabels are Years
When we click on a command button to generate a chart, it works fine.  When we chlick the button a second time
 we get a run time error 1119 which says Object is uninitialized or invalid.  The program stops at the line where we are tyring to assign lables. i.e., "Mschart1.DataGrid.RowLabel(1,1) = "jan"  ...etc....
Thank you for your response to the same question, hope this is more specific. Would appreciate a response ASAP

Here's the code you asked for:

MSChart1 = CostArray 'CostArray is a 12 X 8 two-way array

If cmdShort = True Then
    MSChart1.Title = "SHORT TERM COST ANALYSIS"
ElseIf cmdLong = True Then
    MSChart1.Title = "Long TERM COST ANALYSIS"
ElseIf cmdVacation = True Then
    MSChart1.Title = "Vacation TERM COST ANALYSIS"
End If


MSChart1.DataGrid.RowLabel(1, 1) = " "
MSChart1.DataGrid.RowLabel(2, 1) = "jan"
MSChart1.DataGrid.RowLabel(3, 1) = "feb"
MSChart1.DataGrid.RowLabel(4, 1) = "mar"
MSChart1.DataGrid.RowLabel(5, 1) = "apr"
MSChart1.DataGrid.RowLabel(6, 1) = "may"
MSChart1.DataGrid.RowLabel(7, 1) = "jun"
MSChart1.DataGrid.RowLabel(8, 1) = "jul"
MSChart1.DataGrid.RowLabel(9, 1) = "aug"
MSChart1.DataGrid.RowLabel(10, 1) = "sept"
MSChart1.DataGrid.RowLabel(11, 1) = "oct"
MSChart1.DataGrid.RowLabel(12, 1) = "nov"
MSChart1.DataGrid.RowLabel(13, 1) = "dec"

MSChart1.DataGrid.ColumnLabel(1, 1) = 1996
MSChart1.DataGrid.ColumnLabel(2, 1) = 1997
MSChart1.DataGrid.ColumnLabel(3, 1) = 1998
MSChart1.DataGrid.ColumnLabel(4, 1) = 1999
MSChart1.DataGrid.ColumnLabel(5, 1) = 2000
MSChart1.DataGrid.ColumnLabel(6, 1) = 2001
MSChart1.DataGrid.ColumnLabel(7, 1) = 2002
MSChart1.DataGrid.ColumnLabel(8, 1) = 2003

MSChart1.Legend.Location.Visible = True

In other words how can we refresh the chart with new data?
At present when we try to do so we get an error
0
Comment
Question by:gitar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
  • 2
  • +2
11 Comments
 
LVL 5

Expert Comment

by:bin_huwairib
ID: 1437640
gitar,

Post your code to figure out you problem.


Best regards
Bin Huwairib
0
 
LVL 4

Expert Comment

by:zsi
ID: 1437641
gitar,

I'm sure that, by now, you are aware that you have posted the same question twice?
0
 

Author Comment

by:gitar
ID: 1437642
Edited text of question
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

Author Comment

by:gitar
ID: 1437643
Adjusted points to 70
0
 

Author Comment

by:gitar
ID: 1437644
Edited text of question
0
 

Author Comment

by:gitar
ID: 1437645
Adjusted points to 100
0
 

Author Comment

by:gitar
ID: 1437646
Adjusted points to 110
0
 

Expert Comment

by:duc
ID: 1437647
What kind of error ?
Duc
0
 

Expert Comment

by:duc
ID: 1437648
Sorry I just saw it.
Duc
0
 
LVL 6

Accepted Solution

by:
clifABB earned 110 total points
ID: 1437649
Apparently you can't redim a chart. (MSChart1 = CostArray can only be used once)
0
 
LVL 5

Expert Comment

by:bin_huwairib
ID: 1437650
gitar,

Try the following code:

Private Sub Command1_Click()
 Dim CostArray(1 To 12, 1 To 8) As Integer
 Dim RowCount As Integer
 Dim ColumnCount As Integer

 RowCount = UBound(CostArray, 1)
 ColumnCount = UBound(CostArray, 2)
 MSChart1.RowCount = RowCount
 MSChart1.ColumnCount = ColumnCount
 For Row = 1 To RowCount
  For Column = 1 To ColumnCount
   MSChart1.Row = Row
   MSChart1.Column = Column
   MSChart1.Data = CostArray(Row, Column)
  Next
 Next
 
 If cmdShort = True Then
  MSChart1.Title = "SHORT TERM COST ANALYSIS"
 ElseIf cmdLong = True Then
  MSChart1.Title = "Long TERM COST ANALYSIS"
 ElseIf cmdVacation = True Then
  MSChart1.Title = "Vacation TERM COST ANALYSIS"
 End If
 
 MSChart1.DataGrid.RowLabel(1, 1) = "jan"
 MSChart1.DataGrid.RowLabel(2, 1) = "feb"
 MSChart1.DataGrid.RowLabel(3, 1) = "mar"
 MSChart1.DataGrid.RowLabel(4, 1) = "apr"
 MSChart1.DataGrid.RowLabel(5, 1) = "may"
 MSChart1.DataGrid.RowLabel(6, 1) = "jun"
 MSChart1.DataGrid.RowLabel(7, 1) = "jul"
 MSChart1.DataGrid.RowLabel(8, 1) = "aug"
 MSChart1.DataGrid.RowLabel(9, 1) = "sept"
 MSChart1.DataGrid.RowLabel(10, 1) = "oct"
 MSChart1.DataGrid.RowLabel(11, 1) = "nov"
 MSChart1.DataGrid.RowLabel(12, 1) = "dec"
 
 MSChart1.DataGrid.ColumnLabel(1, 1) = 1996
 MSChart1.DataGrid.ColumnLabel(2, 1) = 1997
 MSChart1.DataGrid.ColumnLabel(3, 1) = 1998
 MSChart1.DataGrid.ColumnLabel(4, 1) = 1999
 MSChart1.DataGrid.ColumnLabel(5, 1) = 2000
 MSChart1.DataGrid.ColumnLabel(6, 1) = 2001
 MSChart1.DataGrid.ColumnLabel(7, 1) = 2002
 MSChart1.DataGrid.ColumnLabel(8, 1) = 2003

 MSChart1.Legend.Location.Visible = True
End Sub


Best regards
Bin Huwairib
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question