Microsoft Office 2000 Developer |
You can display the most current data by placing a Microsoft Chart control on a Microsoft PowerPoint slide and binding it to an appropriate numeric field in a database.
The following example binds the Chart control to the UnitPrice field of the Products table in the Northwind sample database.
To display a data-bound chart on a PowerPoint slide
Option Explicit
Private rsProducts As ADODB.Recordset
Private cn As ADODB.Connection
Private Sub Commandbutton1_Click()
Set cn = New ADODB.Connection
' Change the ConnectionString to one that's appropriate to
' the provider and database you are connecting to.
cn.ConnectionString = "DSN=Northwind"
cn.Open
Set rsProducts = New ADODB.Recordset
RsProducts.Open "SELECT UnitPrice FROM Products", cn, adOpenStatic, adLockOptimistic
' The Chart control is named chtPrices
Set chtPrices.DataSource = rsProducts
' Close the Recordset object and the Connection object.
rsProducts.Close
cn.Close
End Sub