Accessing text box value

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi

I am trying to access the value of a textbox in its 'on change' event as
follows;

msgbox Me.Company.Text

But I am getting the error 'You can't reference a property or method for a
control unless the control has the focus.'.

How can I get the current text in the textbox as the user types each
character?

Thanks

Regards
 
Unlike pure VB, you do not need the ".Text" bit in Access.

Try:
MsgBox Me.Company

That's the equivalent of:
MsgBox Me.Company.Value

The Text property applies only to the text string that is in the text box
while it has focus, and before it has been validated and assigned to the
Value property. For example, when you are entering a date but have not yet
entered the year, the Text may be:
05/22/
However, that could never become the Value as it is not a valid date.
 

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

Back
Top