Calling Procedure in Subform error

BenWeber

Registered User.
Local time
Today, 18:13
Joined
Apr 27, 2006
Messages
10
I have a form, Salesperson, that has a subform Salesperson_SalesGraph. The SalesGraph subform is a pivot chart.

I'm having problems with trying to access items on the subform. The weirdest part is that it seems to work if i call the event from form_open, but doesn't work if i move the code to form_current. This won't work for me, as i need the function called whenever i change rows.

The error received is: You entered an expression that has an invalid reference to the property Form/Report.

First I had the code on the main form, accessing the chart object on the subform but was getting errors that i couldn't access the form property in the assignment, Set objChartSpace = Me.salesperson_salesgraph.Form.ChartSpace (i tried a number of differnet ways, with !'s, with Forms("SalesPerson_SalesGraph), etc.

Then i moved the code to the subform and now i'm just trying to call the publically declared sub with the line:

Forms!Salesperson!Salesperson_SalesGraph.UpdateLegend
or
Me.Salesperson_SalesGraph.Form.UpdateLegend

The subform has a sub declared as:
Public Sub UpdateLegend()



Any thoughts?
 
If the name of your SubFormControl is Salesperson_SalesGraph then the Me.Salesperson_SalesGraph.Form.UpdateLegend should work. The SubFormControl may or may not be named the same as the form it displays.
 
That's not it. Referring to fields/etc works fine, i just can't call the sub from the main form for some reason.

Thanks for the thought tho, i've been known to do things that silly.
 
Making the SubRoutine in the SubForm Public *should* have made it a method of the SubForm so you can call it with the syntax you have been using. Have you tried using Call with your syntax to see if it works? I've done that exact thing several time without a problem but I checked and I used Call with it.
 

Users who are viewing this thread

Back
Top Bottom