Autofill fields by selecting a record in a combo box

  • Thread starter Art at ABE Computer Consultants
  • Start date
A

Art at ABE Computer Consultants

I have a subform that has several fields. For instance, "scientific
name," "common name," "size," and "cost" These refer to plants used
in quoting a landscaping job. All this data is found in a lookup
table, but there are lots of plants. So--with a combo box that looks
up the "scientific name", I wish to bring in the other 3 fields to the
form after choosing the correct name. I can then add a "quantity" and
do some math and get the total cost for each plant.

For the life of me, I can't remember how to populate the fields after
I do a lookup in the combo box. Does anyone have the answer?

Thanks---Art
 
C

chris

You have a couple of choices
1. If the query that populates the combo box returns all
the fields you want into separate columns you can use

txtDetail.Value = yourcombo.column(x,yourcombo.listindex)

2. if not, use
txtDetail.vaule = dlookup
("DetailField","detailTable","DetailPrimaryKey = " &
yourcombo.column(x,yourcombo.listindex))

in both cases the code should go in combo box click event
 
A

Art at ABE Computer Consultants

OK, I'll give it a try. I also had an IQ surge yesterday reading a
post by someone else--I can just use the relational database like it
is intended to be used. I can assign a key to the primary field or
perhaps the autonumber field and store the info that way. As long as
the values in the lookup table don't change before the estimate it
made.

That way, we can display records for the user, and for the actual
estimate, just do a report.

I hope

Thanks

Art
 

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