MS Access: Set the value of a textbox based on the value of another textbox in Access 2003/XP/2000/97

To set the value of Textbox2 based on the value entered in Textbox1, you need to place your VBA code on the "After Update" event of Textbox1.

To do this, open your form in Design View.

Under the View menu, select Properties. Highlight the textbox called Textbox1. Click on the property called "After Update". A button with 3 dots to the right should appear. Click on this button.



When the Choose Builder window appears, highlight Code Builder. Click on the OK button.



Then place the following code:

Private Sub Textbox1_AfterUpdate()

If Textbox1.Value = "1" Then
Textbox2.Value = "10"
End If

End Sub


Now, when a value of 1 is entered in Textbox1, Textbox2 will automatically be populated with a value of 10.