Accessing Text Box Contents in Code?

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
 
A

Allen Browne

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top