Solved

MS Graph Row Count

Posted on 2003-11-28
3
473 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 100 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

739 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