Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Auto Populate

Status
Not open for further replies.

imagranny

Technical User
Oct 17, 2002
8
0
0
US
How can I auto populate a field? I want to input data in field A and have it automatically put information into field B based on my answer in field A.

Thanks.
 
You would need to attach code to the afterupdate event of your first field.

Can you be more specific? What is it exactly that you want to do?
 
I want to enter a code and have a description populate another field.

Example:
Error Code Description
KMPN Member Not Found

I want to enter the KMPN and have the description automatically populate the description field.

Thanks
 
I assume you have a table or query which contains:
Field 1: Code
Field 2: Description

Set an unbound combobox code field's (cboCodes) rowsource to this table/query. Then set these properties:
Column Count: 2
Column Widths: 2";0"
Bound Column: 2

The code will display in the combobox but the actual value of the field will be the description. Now create your description text box (txtDesc).

In the afterupdate property of the cboCodes, click the ... button, choose code builder, and type this between the Subs:
Code:
Me!txtDesc.Value = Me!cboCodes.Value
What this does is set the value of the textbox equal to the value of the combobox, which, remember is the actual description.

I hope I was correct in my assumptions. If not, please provide more detail.

Good luck!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top