Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Graphs in VB?

Posted on 2000-03-27
2
Medium Priority
?
281 Views
Last Modified: 2010-05-02
I need a really good graph control to display records from SQL7 thru ADO. I need to be able to really customize it.
0
Comment
Question by:hutchison
  • 2
2 Comments
 

Accepted Solution

by:
AshokKumar earned 150 total points
ID: 2662942
Nice Friend. Here it goes. The entire code. <Smile>

First declare a recordset and a connection. Then include the component MSChart in the form. I have used MS Access as backend and as a programmer u would easily convert the Access connection to SQL connection. Remaining all are same (ie. recordset and all that).

Private adoRs As New ADODB.Recordset
Private adoCn As New ADODB.Connection

Then in the form load event

Private Sub Form_Load()

Dim strSql As String

adoCn.ConnectionString = _
   "Provider=Microsoft.Jet.OLEDB.3.51;Data Source=" & _
   "C:\Program Files\Microsoft Visual Studio\VB98\nwind.mdb"

adoCn.Open 'Open the connection
   
   ' Create a query that retrieves only four fields.
   strSql = "SELECT ProductName, UnitPrice, " & _
   "UnitsInStock, UnitsOnOrder FROM Products WHERE SupplierID = 1"

adoRs.Open strSql, adoCn, adOpenKeyset

   ' Set the DataSource to the recordset.
   With MSChart1
      .ShowLegend = True
      Set .DataSource = rsProducts
   End With
End Sub


JUst copy this code and u'll get the result u wanted. U can set the Chart type as graphical type. U have 9 types to choose from. Get back to me.
0
 

Expert Comment

by:AshokKumar
ID: 2671906
Thanks hutchison but y Grade B.
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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

886 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