Textbox

  • Thread starter Thread starter Warrio
  • Start date Start date
W

Warrio

Hello!

Is it possible to write in a textbox without giving it first the focus?
because if I write directly:
Textbox.Text = "Hello"
an error msg says that You cannot reference a field that hasn't the focus

and if try to change its value by writing
Textbox.Value = "hello" or
Textbox = "Hello" this changes nothing, the text displayed will never
have the text "hello"

so what I do is this:
Textbox.SetFocus
Textbox.Text = "Hello"

but is there a way to change the text without giving setting or changing the
focus?

Thanks for any suggestion
 
You can (and should) set the Value of the text box in Access.

If your example did not work, try changing the Name of the text box. The
word "Textbox" is as reserved word.

Unlike pure VB, in VBA (Access) the Text property is only available when the
text box has focus. It refers to the text in the box, which does not become
the Value of the box until it is approved. For example, if you are entering
a date and you have typed
12/12/
then that is the Text of the textbox, but it could never become the Value of
the box, as it is not a valid date.
 
Back
Top