Open form, sub form, control

Hi Experts.

I have a form with a subform and in the sub form there is a control, where i need to change the value.

The code is running from a Public Function in a Module.

Can some one help with this?
DCRAPACCESSAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mbizupCommented:
After the open form statement,

Forms!mainformname.SubformName.Form.ControlName
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DCRAPACCESSAuthor Commented:
I get a error when i try this:
MsgBox Forms!DCDK_ReportingInfo.Ekstra_reporting.Form.Controls(ctlname).Value

Also this give an error:
MsgBox Forms!DCDK_ReportingInfo.DCDK_ReportingInfo_ER.Form.Controls(ctlname).Value

"Ekstra_reporting" is the sub form name, the sub forms object name is "DCDK_ReportingInfo_ER".

The control name comes from a string ("ctlname").
0
mbizupCommented:
What is the exact error?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

DCRAPACCESSAuthor Commented:
It should be something like this, but can't get it to work:
Forms!Mainform!Subform1.Form!ControlName
0
peter57rCommented:
You should not use the subform name anywhere in the command.(except by coincidence)

The subform reference needs to be the name of the subform container control on the main form.

Forms!mainformname!subformcontainercontrolname.Form!controlname
0
DCRAPACCESSAuthor Commented:
Sorry, my bad! I was referring to the wrong sub form name :-( Sorry for wasting every ones time mbizup wrote the right answer in the first response.
0
mbizupCommented:
No trouble.  The distinction Pete made is an important one, and I was lazy in my post. The name of the subform control is what is needed. That is the Name property of the 'frame' that houses the subform. It is frequently the same as the subform name, but not always.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.