By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,264 Members | 1,237 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,264 IT Pros & Developers. It's quick & easy.

Can some one tell me How to access subfroms component value

P: 91
Hi people,
Can Some one help me out in this. i want to access a component values in the main form Through Coding How can i do that
Expand|Select|Wrap|Line Numbers
  1.  If Not IsNull(Me.cbocustomer) Then
  2.                db.Execute " UPDATE Contract_cashflow SET Credit_Note = 'Credit Note' WHERE CashflowContractNo = '" & Me.frmcreditnotesub.Controls(cboInvoiceNo).Column(2) & "'And CashflowNumber = " & Me.frmcreditnotesub.Controls(cboInvoiceNo).Column(1) & " "
  3.                End If
below i have attached the file for more clear picture. i want to access a com box component
please help
Attached Files
File Type: doc Doc1.doc (72.0 KB, 136 views)
Sep 26 '12 #1
Share this Question
Share on Google+
2 Replies

Expert Mod 5K+
P: 5,397

You're not very clear.
Title concerns accessing a control on a subform
Question is accessing a control on the main form.

What is it you're asking here?

To answer the title:
forms!mainformname!subformname.form! ntrolproperty

The new "navigation control" introduced in v2007/2010 tosses in a whole lot of twists that even I'm trying to learn; thus, if that's what you're after you'll have to have a much better explanation of the problem.

Be Aware that most of the time we're not going to open un-asked for files/documentation... nothing against you personally, just best practice... can't afford to damage either company or personal property.
Sep 26 '12 #2

Expert Mod 100+
P: 2,321
Your question should be explainable in clear english with the possible use of images, or to show example records a .csv or .txt would also be acceptable. Usually you should not attach .doc .xls or .mdb/.accdb files unless specifically asked for, by an expert.

When you place a form into a another form, access creates a special control, a subform control. Think of this control as a container object, that stores your subform, and various properties such as Master/child relations.

Therefore I recommend to ensure clarity by renaming the control on your main form, for example if I place a Order form Frm_Orders as a subform, I rename the control: SubForm_Orders.

Now to access something in your subform, you need to remember to go through the container object.

Expand|Select|Wrap|Line Numbers
  1. Me.SubForm_Orders.Form.ControlName
The .Form part indicates that we want to access the form stored in the control Me.SubForm_Orders
Sep 26 '12 #3

Post your reply

Sign in to post your reply or Sign up for a free account.