Pedro
Pedro

Reputation: 4160

Charts aren't rendered in MS Access forms

I created a form that contains 5 charts. When opening, the cursor changes 5 times, so obviously the data is queried, but the charts aren't rendered and left blank. However, when moving the form outside of the screen and back in, parts of the chart are shown, so it seems that is just a repaint missing.

I tried to execute me.chart1.repaint on several events, but I haven't found the appropriate event and I am not sure if me.chart1.repaint is actually necessary.

Upvotes: 1

Views: 2765

Answers (3)

MarkF
MarkF

Reputation: 1

Sometimes the form is doing too many things while rendering the graphs, and the actual painting does not have time to finish before processing moves on the next object. You can force Access to "catch a breath" like this:

Private Sub Detail_Paint()

    DoEvents

End Sub

Since the Detail section of the form is doing the actual rendering, it has a chance to finish each object before moving on to the next.

Upvotes: 0

Bill
Bill

Reputation: 26

Private Sub chart1_Updated(Code as integer)
    me!chart1.Visible = True
End Sub

Don't worry if visible already true!

Upvotes: 1

Pedro
Pedro

Reputation: 4160

I am using this code as a workaround:

 Private Sub chart1_Updated(Code As Integer)
      DoCmd.Minimize
      [Forms]![myform].SetFocus
      DoCmd.Restore
 End Sub

Upvotes: 1

Related Questions