auto fill

  • Thread starter Jen27 via AccessMonster.com
  • Start date
J

Jen27 via AccessMonster.com

Hi Access Gurus.

I'm just learning, so please forgive my ignorance.

I have a form with fields called "Person Contacting" and "Area" (amoung
others). The Person contacting field is currently a combo box linked to a
table "Contact Names".

The "Contact Names" table has two columns 1 = "Name" and 2 = "Area".

I'd really like to be able to be able to pick the name from the combo box in
the "Person Contacting" field and have the "Area" field automatically filled
in with the corresponding contents from column 2 ("Area") in the "Contact
Names" table.

The table behind the form needs both to be filled in, however neither are
primary keys.

Thanks,
Jen
 
A

Arvin Meyer [MVP]

If you simply add the Primary Key to the underlying table (from the combo
box) it will satisfy all you need for a query to return the values in those
columns, without ever having to store those values a second time. If you
still insist on storing it a second time, just use the column property of
the combo to push the values into the proper textboxes in the combo's after
update event. Substituting your control names, try something like:

Sub MyCombo_AfterUpdate()
Me.txtName = Me.[cboPerson Contacting].Column(0)
Me.txtArea = Me.[cboPerson Contacting].Column(1)
End Sub

The column index property is zero based.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access
 

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