Hello its me again with another strange one. I have a form that displays a big graph of individual elements, that the user selects off a pull down menu.
When selected, several functions are called to set the graphs source with the right sql to get the data for the graph.
The second function sets the y axis to the highest value in the data and the third requeries and sets the graph to visible.
When I select the element I am getting the following the error message:
"Run time error '1004':
Unable to set the maximum property of the Axes class"
this is the function code that is supposed to do it
Function SetAxisLimit()
Forms!LabGraphElement![MxXCtl] = MxX
Forms!LabGraphElement![MxYCtl] = MxY
MaxYaxis = DMax("[Elements]", "Qry_GetGraphRange", "[ElementId] =""" & [Forms]![LabGraphElement]![SelectElement] & """")
Forms!LabGraphElement![GraphMain].Object.Application.Chart.Axes(2).MaximumScale = MaxYaxis
End Function
I had another problem and was told here to properly normalise my tables, so this is a direct copy of the old database where this graph works perfectly. Since normalising the database required spliting the tables up I had to redo all the queries and forms. I have set this new version of the database to have exactly the same references as the old version, which i thought may have been the problem.
To make matters more confusing, when I get this error I can debug or end it. If I push end, and select the element again, it will work, even setting the axes limit.
when the form is opened the graph is activated and then set invisible, and waits for the selection then fails, but only on the first time, which I dont at all understand.
Anyone have any clue to why I get this error and why if I end the error dialog and re-select it suddenly works perfectly?
When selected, several functions are called to set the graphs source with the right sql to get the data for the graph.
The second function sets the y axis to the highest value in the data and the third requeries and sets the graph to visible.
When I select the element I am getting the following the error message:
"Run time error '1004':
Unable to set the maximum property of the Axes class"
this is the function code that is supposed to do it
Function SetAxisLimit()
Forms!LabGraphElement![MxXCtl] = MxX
Forms!LabGraphElement![MxYCtl] = MxY
MaxYaxis = DMax("[Elements]", "Qry_GetGraphRange", "[ElementId] =""" & [Forms]![LabGraphElement]![SelectElement] & """")
Forms!LabGraphElement![GraphMain].Object.Application.Chart.Axes(2).MaximumScale = MaxYaxis
End Function
I had another problem and was told here to properly normalise my tables, so this is a direct copy of the old database where this graph works perfectly. Since normalising the database required spliting the tables up I had to redo all the queries and forms. I have set this new version of the database to have exactly the same references as the old version, which i thought may have been the problem.
To make matters more confusing, when I get this error I can debug or end it. If I push end, and select the element again, it will work, even setting the axes limit.
when the form is opened the graph is activated and then set invisible, and waits for the selection then fails, but only on the first time, which I dont at all understand.
Anyone have any clue to why I get this error and why if I end the error dialog and re-select it suddenly works perfectly?