Need help referencing a column in a combo box in a querry.

F

FatMan

Hi all:
I need to know who to reference the 5th column in a combo box to use the
value in an update querry.

The name of the combo box is: cmbOrigReq
Tha name of the form the combo is on is: frmReqSel

I can get a msgbox to display the value of the 5th column with the code:
MsgBox Me.cmbOrigReq.Column(5)

Like I said above I need to run an update querry on the value of the 5th
column. I have tried the following:
[Forms]![frmReqSel]![cmbOrigReq].[Column(5)] - acts as if it was a parameter
querry

[Forms]![frmReqSel]![cmbOrigReq].Column(5) - responds that the code is an
invalid function.

How do I reference the 5th column in the combo box mentioned above in an
update querry?

Any help would be greatly appreciated.

Thanks,
FatMan
 
R

Rick Brandt

FatMan said:
Hi all:
I need to know who to reference the 5th column in a combo box to use the
value in an update querry.

The name of the combo box is: cmbOrigReq
Tha name of the form the combo is on is: frmReqSel

I can get a msgbox to display the value of the 5th column with the code:
MsgBox Me.cmbOrigReq.Column(5)

Like I said above I need to run an update querry on the value of the 5th
column. I have tried the following:
[Forms]![frmReqSel]![cmbOrigReq].[Column(5)] - acts as if it was a parameter
querry

[Forms]![frmReqSel]![cmbOrigReq].Column(5) - responds that the code is an
invalid function.

How do I reference the 5th column in the combo box mentioned above in an
update querry?

Any help would be greatly appreciated.

You might be able to use...

Eval([Forms]![frmReqSel]![cmbOrigReq].Column(5))

....but what I usually do is add a hidden TextBox to the form with a
ControlSource of...

=ComboBoxName.Column(5)

....and then I reference the hidden control in the query instead of the ComboBox.
 

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