Subform Syntax

T

Tony Williams

I have a form (tblcommittees) based on Table A and a subform (tblcommittees
subform) based on Table B. On the subform I have a combobox (cmbIntCommCode)
based on Table C. The control source for the value of the combobox is
IntCommCodetxt in Table B. I have a text box which I am trying to get the
value of column(2) from the combo box but all I get is #Name. I have tried
IntCommCodetxt.Column(2) and cmbIntCommCode.column(2) but neither work. I am
using the right syntax?
 
W

Wayne Morgan

Whether or not you're using the correct syntax will depend a lot on where the textbox is.
If the textbox is on the subform with the combo box then the control source for the
textbox would be:

=cmbIntCommCode.Column(1)

The column index is zero based, the first column is 0, the seconds is 1, the third is 2,
etc.
 
T

Tony Williams

Hi Wayne that's what I thought but I still get #Name. Here are my control
details

combobox control source- IntCommCodetxt
combobox name- cmbIntCommCode
The combobox is a list from a table called tblCommittees and is calculated
using this formula
SELECT [tblCommittees].[CommIndex], [tblCommittees].[CommCodetxt],
[tblCommittees].[CommNametxt] FROM tblCommittees;

textbox control source- =[cmbIntCommCode].column(2)
textbox name- IntCommNametxt
The two fields are on the same subform

IntCommCodetxt is a control in a table called tblIntCommittees where the
value of the combobox is stored.

What am I doing wrong?

Tony

Wayne Morgan said:
Whether or not you're using the correct syntax will depend a lot on where the textbox is.
If the textbox is on the subform with the combo box then the control source for the
textbox would be:

=cmbIntCommCode.Column(1)

The column index is zero based, the first column is 0, the seconds is 1, the third is 2,
etc.
 
T

Tony Williams

Sorry Wayne everything OK now must have been dyslexic fingers!!!
Tony
Tony Williams said:
Hi Wayne that's what I thought but I still get #Name. Here are my control
details

combobox control source- IntCommCodetxt
combobox name- cmbIntCommCode
The combobox is a list from a table called tblCommittees and is calculated
using this formula
SELECT [tblCommittees].[CommIndex], [tblCommittees].[CommCodetxt],
[tblCommittees].[CommNametxt] FROM tblCommittees;

textbox control source- =[cmbIntCommCode].column(2)
textbox name- IntCommNametxt
The two fields are on the same subform

IntCommCodetxt is a control in a table called tblIntCommittees where the
value of the combobox is stored.

What am I doing wrong?

Tony

Whether or not you're using the correct syntax will depend a lot on
where
the textbox is.
If the textbox is on the subform with the combo box then the control source for the
textbox would be:

=cmbIntCommCode.Column(1)

The column index is zero based, the first column is 0, the seconds is 1, the third is 2,
etc.
work.
I am
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top