?
Solved

Open form, sub form, control

Posted on 2011-10-05
7
Medium Priority
?
428 Views
Last Modified: 2013-11-28
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?
0
Comment
Question by:DCRAPACCESS
  • 3
  • 3
7 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 2000 total points
ID: 36915256
After the open form statement,

Forms!mainformname.SubformName.Form.ControlName
0
 

Author Comment

by:DCRAPACCESS
ID: 36915300
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
 
LVL 61

Expert Comment

by:mbizup
ID: 36915330
What is the exact error?
0
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

 

Author Comment

by:DCRAPACCESS
ID: 36915349
It should be something like this, but can't get it to work:
Forms!Mainform!Subform1.Form!ControlName
0
 
LVL 77

Expert Comment

by:peter57r
ID: 36915355
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
 

Author Comment

by:DCRAPACCESS
ID: 36915392
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
 
LVL 61

Expert Comment

by:mbizup
ID: 36915568
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

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
If you’re using QODBC to update QuickBooks data from Microsoft® Access but Access is not showing the updated data, you could have set up QODBC incorrectly.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question