Using Access 2013.
I have two textboxes. The first has a number and the second is empty at the moment. Where would I put an if then else formula, so that if txt1 = 10 then txt2 = Brown else if etc.
Thanks for any help.
Using Access 2013.
I have two textboxes. The first has a number and the second is empty at the moment. Where would I put an if then else formula, so that if txt1 = 10 then txt2 = Brown else if etc.
Thanks for any help.
That depends on when you want to do the check. If you want to do it as soon as you move onto a record which already contains data, put the code in the On Current event of the form. If you want to do the check after after you enter data in to txt1, then put it in the After Update event of the txt1 textbox.
The data is already in txt1 so I would put it in On Current. alright, thanks.
You might have to put the code in both events.
The current event fires when you move to a different record.
The control afterupdate events fires after you enter/change the data.
With the code in the current event only, and you are in a NEW record and enter data into the text box, the other text box will not change. Move to a different record, then back, the second text box will be updated.
With the code in both events, enter/change data in the first text box, the text box afterupdate event will fire and update the second text box. Changing to a different record the current event, the event will fire and update the second text box.