Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

MS Graph Row Count

Posted on 2003-11-28
3
Medium Priority
?
496 Views
Last Modified: 2007-12-19
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?

0
Comment
Question by:lilputian
[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
  • 2
3 Comments
 
LVL 9

Accepted Solution

by:
svenkarlsen earned 400 total points
ID: 9840619
Hi lilputian,

You could check the recordcount by running the same query from a function:

Dim cnn As New ADODB.Connection
Dim rst As New ADODB.Recordset

Set cnn = CurrentProject.Connection
rst.ActiveConnection = cnn
rst.Open SQLstr, cnn, adOpenKeyset, adLockOptimistic
rst.movelast

If rst.RecordCount > 0 Then
    Debug.Print "Found " & rst.RecordCount & " records"
end if


Kind regards,
Sven
0
 
LVL 1

Author Comment

by:lilputian
ID: 9840762
Seems inefficient doesn't it?  Is there no way to check for returned records .. with a listbox I use '.listcount'.  
0
 
LVL 9

Expert Comment

by:svenkarlsen
ID: 9840846
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
0

Featured Post

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

730 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