Accessing Text Box Contents in Code?

  • Thread starter Thread starter Martin Dashper
  • Start date Start date
M

Martin Dashper

In Access 2002, how can I access, in code, the live contents of a
text box on a form, as that data is being entered?

I can get/set the insertion point using textBoxName.SelStart but
textBoxName.Value does not reflect the contents of the box until focus
is moved elsewhere.

At the moment, I am creating a shadow copy of the text box in a
buffer, updating it in response to KeyPress and KeyDown events, but
that seems messy and hopefully unnecessary, and gets quite complicated
when it comes to taking note of the states of the Delete and Insert
keys!

Martin Dashper
 
If the text box has focus, you use use the Text property, e.g.:
Debug.Print Me.MyTextbox.Text
 
Back
Top