×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

graph with access database - im on vb6
2

graph with access database - im on vb6

RE: graph with access database - im on vb6

Possible? yes. Where are you stuck?

RE: graph with access database - im on vb6

(OP)
peraph is your first your help for me... (bho)

three question...
-1 in my case the current project have a fixed 30 shape, in my access the fields are 74... how to create dinamiclly the shape element
-2 in my case i can have a negative number in PERC, in this case the shape it must go below and not above
-3 i need to use the value in recordest not in a rnd


https://files.engineering.com/getfile.aspx?folder=...


RE: graph with access database - im on vb6

>peraph is your first your help for me

???

>how to create dynamically the shape element

So you've decided that the way to do this is by programmatically creating shapes, presumably to create the bars of a bar chart, or slices of a pie chart (etc).

Why not consider the control that Microsoft provide for exactly this purpose - the Microsoft Chart Control.
>i need to use the value in recordest not in a rnd
You can directly feed the Chart control a recordset* (with the ANNO and PERC columns)

> in my case i can have a negative number in PERC, in this case the shape it must go below and not above

So, a bar chart. And yes, I know how barcharts work with negative numbers ...


* There is actually a slight challenge here depending on the regional decimal symbol in use on the PC that will be running the code, since you seem to have elected to make PERC a text column which needs to be converted to a number



RE: graph with access database - im on vb6

(OP)
hI strong, use the best and symple way to do tath.
A msgraph is the same. Tks

RE: graph with access database - im on vb6

2
Can't believe I am doing this, given your apparent unwillingness to do anything to help yourself, but:

CODE -->

Option Explicit

' requires a Microsoft Chart Control on the form
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" 'depends which version of Access we are working against
         .Provider = "Microsoft.Jet.OLEDB.4.0"
        .ConnectionString = "User ID=Admin;password= ;" & " Data Source=F:\test.mdb;" 'path to your mdb file goes here
        .CursorLocation = adUseClient
        .Open
        
        'rs.Open "SELECT cstr(ANNO), cdbl(PERC) FROM TABELLA_STORIA", cnn, adOpenStatic, adLockReadOnly   '  assumes regional decimal seperator is a comma  since that is what is being used in PERC field
        rs.Open "SELECT cstr(ANNO), [SERVIZIO]/100 AS PERC FROM TABELLA_STORIA", cnn, adOpenStatic, adLockReadOnly   'since PERC appears to actually be SERVIZIO/100 this works whatever regional decimal symbol is in use

        rs.MoveFirst ' make sure first row is available to chart
        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 

RE: graph with access database - im on vb6

(OP)
TKS strong.
only one...
possible to paint the bar in green for positive bar number, and in red negative bar number?

RE: graph with access database - im on vb6

The VB6 chart control does not support different colours for different values in a series, I'm afraid.

RE: graph with access database - im on vb6

(OP)
ok understand.

RE: graph with access database - im on vb6

(OP)
Hi strong,
if you see in the form(chart.zip) are present 30 shape.
Is possible via code to create instead the current 30 shapes a dinamic number of shape for example 47 shapes, started for the shape array(0)?

RE: graph with access database - im on vb6

I'm afraid that I am NOT going to write you a graphing utility. But in answer to your question, of course it is possible

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close