Auto Populate Please!

  • Thread starter Thread starter Rachel
  • Start date Start date
R

Rachel

I've tried the SetValue on this and it won't work.

I have a combo box in a form pulling values from a lookup
table. My lookup table has two fields - ID and Name.
Both of these fields are in my form as well...however, I
want the Name field to populate with the correct Name when
the ID combo box is filled in instead of having two combo
boxes.

My SetValue attempt had the Name field in the form as the
object and the Name field in the lookup table as the value
and I set it to run after the ID field was updated and it
comes back and says this object does not contain my lookup
table.

I want it to work like a subform would do, once you enter
a value from the master field it automatically poplates
with the rest of the info - without having to have a
subform. This is for data entry.

Thanks for your help!!
 
This URL has info on how this can be set up:
http://www.mvps.org/access/forms/frm0058.htm

The above example uses VBA code for the "bound textbox" example, but is
reasonably easy to adapt to a macro setup. Simply use a macro action similar
to this:

macSetValueOfBox (attach it to the AfterUpdate event of the combo box)
Action: SetValue
Item: Forms!FormName!txtBoxName
Expression: Forms!FormName!cboBoxName.Column(x)

where x is the column number *minus 1* that holds the value that you want to
put in the textbox.
 
Back
Top