Link to home
Start Free TrialLog in
Avatar of lilputian
lilputian

asked on

MS Graph Row Count

I'm trying to query the number of rows returned from a MS Graph object. The RowSource is set to a SQL stmt. I then want to know if any records were returned for graphing. I've tried the following to return # of columns:

  If Me.OLEGraph1.ColumnCount < 1 then ...

but the ColumnCount always seems to = 0. Any ideas on how to query for Rows, or if any records were returned?

ASKER CERTIFIED SOLUTION
Avatar of svenkarlsen
svenkarlsen

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lilputian
lilputian

ASKER

Seems inefficient doesn't it?  Is there no way to check for returned records .. with a listbox I use '.listcount'.  
Lilputian,

it may appear inefficient, but please remember that the Graph is not Access, but a separate application. You can probably retrieve info on the number of rows/records involved in a current graph, but that would mean using the Graph application-object as interface.

I prefer to avoid doing so. I don't use the Graph in that way, so I can't say anything about the Graph application-object, but I know how things get slowed down by use of the Word or Excel application.

You could try:
    myVar = Me.myChart.Application.DataSheet.Rows.count

where Mychart is the name of your Graph object on your form.

Which approach to choose depends on the size of the database supplying the data for the Graph, of course.

Also have a look at:
   http://msdn.microsoft.com/library/en-us/vbagr10/html/grtocObjectModelApplication.asp

to learn more about programming for the Graph object.


Sven