In Access, I have a form in which there are three text fields. I am trying to update a text box called tbxCombinedName using a combination of both:
- textbox tbxLastName (person Surname)
- textbox tbxFirstName (person's name)
My question is: what property of the text field I use, so when I type in tbxLastName, the CombinedName text field is updated immediately and then stored in the Contacts table.
At the Microsoft website , I found that the step process when entering a text field is as follows:
KeyDown → KeyPress → BeforeInsert → Edit → KeyUp
I tried using the OnChange and OnKeyDown properties, but to no avail. Which property, in combination with which code, will allow you to work with the update as you appear?
This is what I wrote earlier that didn't work:
Private Sub tbxLName_change()
Dim lastName As String
Dim nameCode As String
lastName = tbxLName.Value
Debug.Print lastName
nameCode = tbxNameCode.Value
nameCode = lastName
Debug.Print nameCode
End Sub
Thanks for your help in advance.
source
share