MSGRAPH Formatting Question

donjuay
02-20-2005, 09:03 PM
Hi All,

I have managed to set up MSGRAPH OK on my project however, when I try to populate a line graph from one column in my DB, it only returns one record. Does anyone now how I can populate with all records in my column.

Here's my code

Public Sub score2()
Dim rs As New ADODB.Recordset, sQL As String
sQL = "SELECT score2 " _
& " FROM table1;"
rs.Open sQL, sConn, adOpenStatic, adLockReadOnly, adCmdText

OLE2.Class = "MSGraph.Chart" 'Specify the class name of the OLE control
OLE2.OLETypeAllowed = 2 'Embedded objects only (2 is default)
OLE2.Format = "CF_TEXT" 'OLE object will accept Clipboard format data
OLE2.Action = 0 'When action = 0, create embedded OLE object
OLE2.DataText = "" 'Ensures the MSGraph object is empty
Set ChartObj2 = OLE2.object.Application.Chart

rs.MoveFirst
DataString2 = vbTab & "1" & vbNewLine
DataString2 = DataString2 & "Score2"

DataString2 = DataString2 & vbTab & rs("score2")

ChartObj2.Type = xlLINE

OLE2.DataText = DataString2

End Sub

I am really stuck on this and have searched high and low for a solution. I am pretty sure the problem is in the 3rd datastring2 line (vbTab).

Any ideas would be much appreciated.

Thanks

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum