Solved

Graphs in VB?

Posted on 2000-03-27
2
247 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 50 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

895 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now