Results 1 to 4 of 4
  1. #1
    AccessThomas is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    May 2015
    Posts
    26

    If textbox = then othertextbox =


    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.

  2. #2
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    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.

  3. #3
    AccessThomas is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    May 2015
    Posts
    26
    The data is already in txt1 so I would put it in On Current. alright, thanks.

  4. #4
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    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.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 04-29-2016, 09:06 PM
  2. Replies: 2
    Last Post: 12-22-2015, 09:09 PM
  3. Replies: 5
    Last Post: 04-30-2015, 01:50 AM
  4. Replies: 2
    Last Post: 04-20-2013, 03:37 AM
  5. Replies: 8
    Last Post: 04-12-2013, 08:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums