Look up value in table depending on combo box.

F

Fletcher

Hi, I have an unbound text box that I would like to look up a value in
a table depending on what the value of a combo box is. I figure it's
something pretty easy.

To explain better, I have a combo box that looks up it's values from a
table (we'll call it TableX). There are three columns in this table:
TableXID, DateEst, and Use. The combo box looks up values in TableXID
where the value in Use are a certain value. I would like for my
unbound text box to display the value that is in the DateEst field
where for the TableXID that is chosen in the combo box.

If anyone can help me, I would be most grateful. I'm sure it's a
really easy fix, but I don't know how to do it yet.

Thanks in advance,

Fletcher...
 
J

Jeff Boyce

If I understand correctly, the DateEst value is in the same row in TableX
that your Use and TableXID are.

If your combo box returns the DateEst field (say, as the third element), you
can use the .Column() command to "load" the unbound text box. But be aware,
because .Column() is zero-based, and starts counting at column#0. If
DateEst is the third element in the combo box's source...

You'd use something like:

Me.YourTextbox = Me.YourCombobox.Column(2)

in the AfterUpdate event of the combo box.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
F

Fletcher

Thanks man, that's awesome.

Fletcher...
Jeff said:
If I understand correctly, the DateEst value is in the same row in TableX
that your Use and TableXID are.

If your combo box returns the DateEst field (say, as the third element), you
can use the .Column() command to "load" the unbound text box. But be aware,
because .Column() is zero-based, and starts counting at column#0. If
DateEst is the third element in the combo box's source...

You'd use something like:

Me.YourTextbox = Me.YourCombobox.Column(2)

in the AfterUpdate event of the combo box.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Top