Help w/textbox in form....trying to have same

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

This the reply I receied from before...can someone write on this is to look
also is this a code, an expression builder or an macro?


I am trying to see if I can do this....I have one text box in my form that
has a number that I will enter myself and I want another text box on this
same form but in another place to be populated after I fill in the number
from the first text box. Can this be done and if so, how do I do it?
Use the after update event of the first textbox.

So your code would look something something like:

Private Sub txtMyFirstTextbox_AfterUpdate()
txtMySecondTextbox = "Some new value 123"
End Sub
 
It is VBA code and as the poster said, it goes in the After update event of
the text box you will enter the number in. To get this code where it needs
to be, Open your form in design view. Select the text box you will enter the
number in. Select Properties, then the Events Tab. Put your cursor in the
box labeled After Update. Click on the button to the right with the 3 dots.
Select Code Builder. The VBA editor will open. You will see it is in a sub
named with the name of your text box and _AfterUpdate. Paste the code there.
(Notice I added Me. to the beginning, that is proper form)

Me.txtMySecondTextbox = "Some new value 123"

Replace txtMySecondTextbox with the name of the text box you want to put a
value in.
Replace "Some new value 123" with the value you want to put into the other
text box after you enter your number.
 
I'm still a little lost on this....can you show me how I should have it? My
first text box is named MEDICARE ID AND MY SECOND TEXT BOX IS NAMED OTHER
ID..THIS IS ALL NEW TO ME BUT I AN WILLING TO LEARN....THANKS
 
What do you want to put in OTHER ID after you enter a value in MEDICARE ID?
I will need to know that to be able to help you with this.
 
Ok...when I enter the medicare id I want the second text box to automatically
fill in with that info.....example..Medicare ID 12345 then I want the second
text box to fill in that info...Thanks
 
Okay, follow my directions from my earlier post. Here is the code to paste:

Me![OTHER ID] = Me![MEDICARE ID]

Now, a note, don't use spaces in names. It complicates coding and can
confuse Access.
 
Back
Top