Larry Brister
asked on
Error: 2455 - You entered an expression that has an invalid reference to the property
Been around the world and back on subforms with some great input by the Experts
I'm able to execute a public sub on my subform with this...
Me!MarketingVisitationClie nt.Form.lo adRows
I'm now trying to set a variable to a function on sub sub form and am getting the error message
This is what I'm executing
Dim s As String
s = Me!MarketingVisitationClie nt.Form.Ma rketingVis itationCli entContact sWorklist. Form.sayWh at
The function on the sub sub form is this
Public Function sayWhat() As String
Set sayWhat = "Larry"
End Function
I'm able to execute a public sub on my subform with this...
Me!MarketingVisitationClie
I'm now trying to set a variable to a function on sub sub form and am getting the error message
This is what I'm executing
Dim s As String
s = Me!MarketingVisitationClie
The function on the sub sub form is this
Public Function sayWhat() As String
Set sayWhat = "Larry"
End Function
remove the word "set"
Public Function sayWhat() As String
sayWhat = "Larry"
End Function
Public Function sayWhat() As String
sayWhat = "Larry"
End Function
ASKER
Make sure that you are using the name of the subform control (which is possibly different from the name of the subform as seen in the Forms window...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
mbizup
I am...to make sure I clicked on the frame in the subform. It and the Subform have the same name
MarketingVisitationClientC ontactsWor klist
I am...to make sure I clicked on the frame in the subform. It and the Subform have the same name
MarketingVisitationClientC
what is the name of the subform where the function sayWhat is ?
try calling the function with this line
Form_nameofSubform.sayWhat
try calling the function with this line
Form_nameofSubform.sayWhat
As a test, see if this works:
s = Form_MarketingVisitationCl ientContac tsWorklist .sayWhat
s = Form_MarketingVisitationCl
;-)
Just checking... it looks like you are loading your subform at run-time. Are you doing the same with your sub-subform?
If so, is MarketingVisitationClientC ontactsWor klist actually loaded as the source object of your sub-sub form at the time you try to execute "sayWhat"?
(If it is not loaded, you will not be able to run that function)
If so, is MarketingVisitationClientC
(If it is not loaded, you will not be able to run that function)
(pages are taking forever to refresh at the moment <sigh>)
ASKER
capricorn and DatabaseMX
This worked...
s = Form_MarketingVisitationCl ientContac tsWorklist .sayWhat
MsgBox s
So...How do I use that so that it's unique to each record?
I'm actually running this from the midle for below.
They are all datasheet view forms with a 1 to many as you go deeper in the forms
The one thing that binds them all together is [Client ID]
Form
Subform
SubFOrm (s = Form_MarketingVisitationCl ientContac tsWorklist .sayWhat)
SubForm
SubForm( Form_MarketingVisitationCl ientContac tsWorklist )
This worked...
s = Form_MarketingVisitationCl
MsgBox s
So...How do I use that so that it's unique to each record?
I'm actually running this from the midle for below.
They are all datasheet view forms with a 1 to many as you go deeper in the forms
The one thing that binds them all together is [Client ID]
Form
Subform
SubFOrm (s = Form_MarketingVisitationCl
SubForm
SubForm( Form_MarketingVisitationCl
<So...How do I use that so that it's unique to each record?>
you may need to pass to the function the value of the unique record or something else..
what are you trying to get as the value returned by the function?
you may need to pass to the function the value of the unique record or something else..
what are you trying to get as the value returned by the function?
Try this
s= Me.Parent.Parent.Sub1.Form .Sub2.Form .Sub3.Form .Marketing Visitation ClientCont actsWorkli st.Form.sa yWhat
Where Sub1,2,3 are the Subform Control Names down that chain ...
mx
s= Me.Parent.Parent.Sub1.Form
Where Sub1,2,3 are the Subform Control Names down that chain ...
mx
ASKER
capricorn1
Well...this journey started with me just trying to access the form.
After about 3 days I discovered that the frame and the subform it was in had different names.
What I'm trying to actually do is run a public routine on that sub form and load data onto it.
I know it seems backwards...but a view or some other linked data source just doesn;t work in this case
So...I would want to run loadData(clientID, visitID)
Well...this journey started with me just trying to access the form.
After about 3 days I discovered that the frame and the subform it was in had different names.
What I'm trying to actually do is run a public routine on that sub form and load data onto it.
I know it seems backwards...but a view or some other linked data source just doesn;t work in this case
So...I would want to run loadData(clientID, visitID)
Curious -- what is in your LoadData routine that is preventing you from including it in a public module rather than as a function in your sub-sub form?
If you place it in a public module, I would think you could get the line-by-line results simply by setting the control source of a textbox on your middle form to:
= LoadData([clientID], [visitID])
(I don't think you can do this if the function is in your sub-sub form)
If you place it in a public module, I would think you could get the line-by-line results simply by setting the control source of a textbox on your middle form to:
= LoadData([clientID], [visitID])
(I don't think you can do this if the function is in your sub-sub form)
ASKER
Folks,
Sorry for the late get back.
In the end, this answer helped me the most.
Hope I haven't ruffled anyone. I truly appreciate everyones answer
Sorry for the late get back.
In the end, this answer helped me the most.
Hope I haven't ruffled anyone. I truly appreciate everyones answer
Open in new window