I ned to rapresent in a graph the value ANNO and PERC...
Possible?
Possible?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
[COLOR=blue]Option Explicit
[COLOR=green]' requires a Microsoft Chart Control on the form[/color]
Private Sub Form_Load()
Dim rs As New ADODB.Recordset
Dim cnn As ADODB.Connection
Set cnn = New ADODB.Connection
With cnn
'.Provider = "Microsoft.ACE.OLEDB.12.0" [COLOR=green]'depends which version of Access we are working against[/color]
.Provider = "Microsoft.Jet.OLEDB.4.0"
.ConnectionString = "User ID=Admin;password= ;" & " Data Source=F:\test.mdb;" [COLOR=green]'path to your mdb file goes here[/color]
.CursorLocation = adUseClient
.Open
[COLOR=green]'rs.Open "SELECT cstr(ANNO), cdbl(PERC) FROM TABELLA_STORIA", cnn, adOpenStatic, adLockReadOnly [COLOR=green]' assumes regional decimal seperator is a comma since that is what is being used in PERC field[/color][/color]
rs.Open "SELECT cstr(ANNO), [SERVIZIO]/100 AS PERC FROM TABELLA_STORIA", cnn, adOpenStatic, adLockReadOnly [COLOR=green]'since PERC appears to actually be SERVIZIO/100 this works whatever regional decimal symbol is in use[/color]
rs.MoveFirst [COLOR=green]' make sure first row is available to chart[/color]
Set MSChart1.DataSource = rs
rs.Close
End With
End Sub
Private Sub Form_Resize()
If WindowState <> vbMinimized Then
MSChart1.Move 0, 0, ScaleWidth, ScaleHeight
End If
End Sub[/color]