Help with placing data in other text boxes from a dropdown list.

M

Michael

I have a dropdown list and have added the code to have the columns show in
adjacent text boxes.

The first input "GR" works with this code =confezione.Column(1)

the other two"lordo" and "perpack" are blank.

I have place the same code in each and changed the column number to 2 & 3.
For some reason each time I paste the code into the control source it is
changed to this,

=[confezione].[Column](2)

If I remove the [] brackets they return. below is the sql for the dropdown
list.


SELECT Confezione.confezione, Confezione.gr, Confezione.lordo,
Confezione.perpack FROM Confezione ORDER BY Confezione.confezione;

thank you for your help
Michael
 
M

Michael

I just noticed it I place 0 or 1 in the code as

=[confezione].[Column](0) or =[confezione].[Column](1) both will return the
date from the first two columns... if I put 2 or 3 they are blank, so the
problem is not the brackets.. Everything looks the same in the properties
boxes
michael
 
R

RuralGuy

Michael said:
I have a dropdown list and have added the code to have the columns show
in adjacent text boxes.

The first input "GR" works with this code =confezione.Column(1)

the other two"lordo" and "perpack" are blank.

I have place the same code in each and changed the column number to 2 &
3.
For some reason each time I paste the code into the control source it is
changed to this,

=[confezione].[Column](2)

If I remove the [] brackets they return. below is the sql for the
dropdown list.


SELECT Confezione.confezione, Confezione.gr, Confezione.lordo,
Confezione.perpack FROM Confezione ORDER BY Confezione.confezione;

thank you for your help
Michael

Hi Michael,

I would think you would need "=Me.confezione.Column(n)" (the Me. operator)
for all of the entries.

hth
 
M

Michael

Thank you,
Funny that the 1st column works without the ".me" but now I remember that
it should have been there..
but when I do add it... I get #Name? in all the fields. Any ideas?
thank you again
Michael





RuralGuy said:
Michael said:
I have a dropdown list and have added the code to have the columns show
in adjacent text boxes.

The first input "GR" works with this code =confezione.Column(1)

the other two"lordo" and "perpack" are blank.

I have place the same code in each and changed the column number to 2 &
3.
For some reason each time I paste the code into the control source it is
changed to this,

=[confezione].[Column](2)

If I remove the [] brackets they return. below is the sql for the
dropdown list.


SELECT Confezione.confezione, Confezione.gr, Confezione.lordo,
Confezione.perpack FROM Confezione ORDER BY Confezione.confezione;

thank you for your help
Michael

Hi Michael,

I would think you would need "=Me.confezione.Column(n)" (the Me. operator)
for all of the entries.

hth
 
R

RuralGuy

Michael said:
Thank you,
Funny that the 1st column works without the ".me" but now I remember
that it should have been there..
but when I do add it... I get #Name? in all the fields. Any ideas?
thank you again
Michael

That usually means Access is getting confused between Field names in tables
and Control names on forms. I usually name TextBox controls
"txtControlName" to avoid this confusion problem.
 
M

Michael

Thanks.. still the same problem..

=[me].[txtconfezione].[Column](1) does not work...

=[txtconfezione].[Column](1) works for the first column
but

=[txtconfezione].[Column](2) works for the first column

gives me blank boxes and

=[me].[txtconfezione].[Column](2)
gives me #Name?

strange.. never had this problem before..
thanks for trying
Michael
 
R

RuralGuy

Michael said:
Thanks.. still the same problem..

=[me].[txtconfezione].[Column](1) does not work...

=[txtconfezione].[Column](1) works for the first column
but

=[txtconfezione].[Column](2) works for the first column

gives me blank boxes and

=[me].[txtconfezione].[Column](2)
gives me #Name?

strange.. never had this problem before..
thanks for trying
Michael

What Version of Access? What OS?

How about some VBA in the AfterUpdate event of the ComboBox?

Me.TextBoxName = Me.txtConfezione.Column(1)
 
J

John Vinson

Thanks.. still the same problem..

=[me].[txtconfezione].[Column](1) does not work...

=[txtconfezione].[Column](1) works for the first column
but

=[txtconfezione].[Column](2) works for the first column

gives me blank boxes and

=[me].[txtconfezione].[Column](2)
gives me #Name?

strange.. never had this problem before..
thanks for trying

Me! is valid *FOR VBA CODE* - it's not needed in Control Sources on
forms.

Do note that the Column property is zero based - so Column(2) is the
*third* column in the combo box's row source query.


John W. Vinson[MVP]
 
R

RuralGuy

John Vinson said:
Me! is valid *FOR VBA CODE* - it's not needed in Control Sources on
forms.

Do note that the Column property is zero based - so Column(2) is the
*third* column in the combo box's row source query.


John W. Vinson[MVP]

Thanks John. I use VBA so I wasn't up to speed on the syntax when used as
a control source for a control. I did however know about the 0 based
index. Always enjoy reading your posts. Thanks again.
 
M

Michael

Thanks john,
I do know that it is "0" is the first. 0 and 1 work.. for some reason...
2,3,4 show blank.. if I place 0 or 1 in the text boxes.. they all work..
showing those columns.. the others do not.
Michael

John Vinson said:
Thanks.. still the same problem..

=[me].[txtconfezione].[Column](1) does not work...

=[txtconfezione].[Column](1) works for the first column
but

=[txtconfezione].[Column](2) works for the first column

gives me blank boxes and

=[me].[txtconfezione].[Column](2)
gives me #Name?

strange.. never had this problem before..
thanks for trying

Me! is valid *FOR VBA CODE* - it's not needed in Control Sources on
forms.

Do note that the Column property is zero based - so Column(2) is the
*third* column in the combo box's row source query.


John W. Vinson[MVP]
 
M

Michael

It was the column count in the controlling dropdown list that was the
problem
thank you all...

michael
Michael said:
Thanks john,
I do know that it is "0" is the first. 0 and 1 work.. for some reason...
2,3,4 show blank.. if I place 0 or 1 in the text boxes.. they all work..
showing those columns.. the others do not.
Michael

John Vinson said:
Thanks.. still the same problem..

=[me].[txtconfezione].[Column](1) does not work...

=[txtconfezione].[Column](1) works for the first column
but

=[txtconfezione].[Column](2) works for the first column

gives me blank boxes and

=[me].[txtconfezione].[Column](2)
gives me #Name?

strange.. never had this problem before..
thanks for trying

Me! is valid *FOR VBA CODE* - it's not needed in Control Sources on
forms.

Do note that the Column property is zero based - so Column(2) is the
*third* column in the combo box's row source query.


John W. Vinson[MVP]
 

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