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.
 
Back
Top