APPLIES TO: ACCESS 2007, 2010 (UNTESTED IN EARLIER VERSIONS)
This tutorial will show you how to fill an Access form text box based on the selection made by a user using a dropdown list box (combo box).
1. Create a dropdown list box (combo box) filled with data from the table / query that you want to use , or type in the values using the combo box wizard. For the purpose of this tutorial I have called mine ‘combo1’. (You can name yours whatever you like, but it is worth having a naming convention and being as descriptive as possible, because as your database grows the few moments you spend on details like that pays dividends).
2. Create the field you want to automatically populate based on the selection made by the user. I will use a text box called ‘textbox1’ (as above think about how you name your own textbox).
3. In form design view click on your combo box
4. In the tools section of the “Design” tab click on the item called “Property Sheet”
5. Select the “Event Tab”
6. On the “After Update ” property click on the little black down arrow / triangle
7. Select “Event Procedure”
8. Click on the three dots next to the little black down arrow / triangle – this will open up the VBA window and you should see the following:
Private Sub combo1_AfterUpdate()
End Sub
(The text “ combo1” straight after the words “Private Sub” will have automatically been replaced by the name of the combo box you are using)
9. On a new line directly between the two lines above add the following:
Me.textbox1 = Me.combo1
(Replacing the text in red “textbox 1“ and ‘combo1’ with the names you have used)
10. Save your changes and test your form / report