How tell if I have typed characters into a textbox?

M

mscertified

When the user initially clicks in a text box I want to position the cursor to
the left, however after typing in some characters I want it to position where
it is clicked. How can I do this? My Click event code is:
If Me!Control.value = Null Then
Me!Control.selstart=0
Me!Control.sellength=0
End if
But it does not work because it appears the value is not set until I exit
the control, so it is still Null after I have typed in characters.
 
A

Allen Browne

While the text box still has focus, examine its Text property, e.g.:
Debug.Print Me!Control.Text

Access is different to purer VB here, because it's data centric. For
example, in a text box bound to a date field, while you are typing the Text
could be just:
3/
but that could never become the Value.
 
D

Douglas J. Steele

In addition to what Allen's told you, you cannot use = (nor any other
comparison operator) to check for Null. You must use the IsNull function:

If IsNull(Me!Control.value) = True Then
Me!Control.selstart=0
Me!Control.sellength=0
End if
 

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