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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Entering data in one text box from entry of another 1

Status
Not open for further replies.

Imbriani

Programmer
Jan 9, 2004
195
US
Is there a way during data entry into a form to fill one text box based on the value in another.

for instance Combobox "Animal" gives the choice of cat or dog. If the user selects "dog", Textbox "Type" records "canine" in the database.

I know displaying data already in a table can be done with way, but I can't figure out how to actually enter the data this way as the control source of the textbox "Type" has to be the field in the table.

 
I am not sure I understand the question but here goes...

You have two text boxes txt1 and txt2

Your user fills in txt1 with "Dog". In the AfterUpdate event of txt1 you can use:

If Me.txt1="Dog" Then
Me.txt2="Canine"
Else
Me.txt2="Feline"
End If


Hope this helps.

OnTheFly
 
This works great. How about if there are more text boxes to be filled, such as Textbox "litter" and if txt1 is dog, then litter is "yes". How would I put that in the if statement?
 
If Me.txt1="Dog" Then
Me.txt2="Canine"
me.Litter="Yes"
Else
...

Hope this helps.

OnTheFly
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top