Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Chart requery

Status
Not open for further replies.

wichtel

Programmer
Apr 7, 2005
12
CH
Hello

I want to display the maximum y scale of a chart in an text box. When I change the source of the chart and requery, I don't get the current maximum y scale but the previous one. Have you any idea how I can get the current maximum scale? the code is like this:

strSQL = "SELECT Date, R68, R69 FROM " & Me.Type

With Me!Subform_Chart!Chart
.RowSource = strSQL
.Requery
End With

With Forms!F_Menu!Subform_Chart!Chart
.axes(2, 1).MaximumScaleIsAuto = True
Chart_LT_Default = .axes(2, 1).MaximumScale
End With

Forms!F_Menu!Subform_Chart.Form.Requery

Thanks for your help!
Tim
 
The only way I know how to fix this is to make Access wait a while for the chart to 'catch up' with the new SQL.

Code:
With Me!Subform_Chart!Chart
    .RowSource = strSQL
    .Requery
End With

    [blue]Dim start As Date
    start = Now
    While DateDiff("s", start, Now) < 1
        [green]'DoEvents[/green]
    Wend[/blue]

With Forms!F_Menu!Subform_Chart!Chart
    .axes(2, 1).MaximumScaleIsAuto = True
        Chart_LT_Default = .axes(2, 1).MaximumScale
End With
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top