on change

  • Thread starter Thread starter jcahi
  • Start date Start date
J

jcahi

I have textBox on a form. I want to write a onChange event that will put
"abc" in the field [fam] from the [trav] table. this field is also on the
same form.

I need the code of the Sub.

thanks
 
(Air Code)
Private Sub textBox_Change()
'If the fam field is on the main form
Me.fam = "abc"
'If the fam field is on a subform of the main form
Me.[MySubformName].Form.[fam] = "abc"
End Sub
 
I have textBox on a form. I want to write a onChange event that will put
"abc" in the field [fam] from the [trav] table. this field is also on the
same form.

I need the code of the Sub.

thanks

The Change event is not a good event to use for this.
The change event fires each time a character is entered in the field,
so if you type the word 'HELLO' the change event will fire 5 times. I
don't think that's what you want. Use the control's AfterUpdate event.
The event will fires just once, when you leave the field.

Me![Fam] = "abc"
 
Back
Top