Test current value....???

BLeslie88

B Leslie
Local time
Today, 12:55
Joined
May 9, 2002
Messages
228
Default value = "000000"

now how do I check what user is entering....?

If on keypress ... first entry is.... say '9' following code shows "000000" and length 6 ... when actual length is 1....

Private Sub txtFld03001_KeyDown(KeyCode As Integer, Shift As Integer)
Dim lenChk As Long
If KeyCode = 9 Then
Else
lenChk = Len(txtFld03001)
End If
lenChk = Len(txtFld03001)
End Sub

I go in to break mode to check value on keypress... I get "000000" ....
Quite useless. I am aiming to tab to next control once they have entered the 6 length requirement.
Goal is to have this application as user friendly as possible, so auto tabbing is a current goal.

Obviously one way around this is to change the default value.

But thereafter entering the first line of data, all data carries down to next line to avoid dbl entry and speed up entry... so.... is there a way to do this...?
 
Last edited:
When the value isn't yet "saved to the control", it isn't reachable thru the .Value property (which you are using implicitly, it is the default property of a control). Try investigating the .Text property of the control in stead.
 
I have.

I checked text. same prob...

I am investigating...

While seeing if anyone knows reply.

Thanks.
 
debug.print "Value: " & me!txtFld03001.value, "Text: " & me!txtFld03001.Text

No difference?
 
no...

could this be because I have a mask too...?

What a headache.

Both give "000000"
 
I've just tested using a mask, and they return different.

After the first character is pressed, the .value property returns the full value, the .text property returns only the mask when there's no default value, when there's a default value, it returns the default value. The key is not yet entered into the control, but can be found in the keycode parameter.

After the second character is pressed, the .value property still returns full value, the .text property returns the first character entered in the correct place in the mask, the second character isn't yet entered into the control, but can be found in the keycode parameter...

You did test more than one keystroke?
 
thanks.

I am home now, I will test this monday morning.
 
Thanks...

BTW.

len function still returned six.

so I had to do

right(variable.text,1) <> "_" as well.

but point is, I did mannage to verify data and length on second keystroke as you said the default changed. and that was on keydown, on change on .text it gave me the first keystroke....
 

Users who are viewing this thread

Back
Top Bottom