Repost: Autopopulate Field

D

DM - NPS

I am new to access and did not understand Lynn's comment earlier. Hopefully
you can help.

I have a lookup table (lu_master) with fields: Primary (unique key),
Scientific, and Common.

In a form (frm_Incidental) I have 2 combo boxes: txtScientific and txtCommon
that use the lookup table above to give the user options to pick.

What I want to do is: if the user selects an option in the txtScientific
field the txtCommon field will autopopulate based on the value found in the
Common field in the lookup table. If the user leaves txtScientific blank and
selects a value for the txtCommon field, the txt Scientific field will
autopopulate based on the value found in the Scientific field in the lookup
table.

I know I have done this in the past but can not remember how. Thanks for
the help.
 
J

John W. Vinson

I am new to access and did not understand Lynn's comment earlier. Hopefully
you can help.

I have a lookup table (lu_master) with fields: Primary (unique key),
Scientific, and Common.

In a form (frm_Incidental) I have 2 combo boxes: txtScientific and txtCommon
that use the lookup table above to give the user options to pick.

What I want to do is: if the user selects an option in the txtScientific
field the txtCommon field will autopopulate based on the value found in the
Common field in the lookup table. If the user leaves txtScientific blank and
selects a value for the txtCommon field, the txt Scientific field will
autopopulate based on the value found in the Scientific field in the lookup
table.

I know I have done this in the past but can not remember how. Thanks for
the help.

You'll need to use the AfterUpdate event of each combo box to set the value of
the other. One question: what is the Control Source of each combo? Does your
form's underlying table have only one species field?

Sample code might be:

Private Sub txtScientific_AfterUpdate()
Me!txtCommon = Me!txtScientific
End Sub

This assumes that both combos have Primary as their bound column.
 

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