Using Tab key in textbox

Blkblts

Registered User.
Local time
Yesterday, 20:38
Joined
Jan 21, 2000
Messages
61
I using the following code from this forum
Private Sub Text0_KeyDown(KeyCode As Integer, Shift As Integer)
Dim stFront As String
Dim stBack As String
Dim lPos As Long
If KeyCode = 9 and Shift = 0 Then
KeyCode = 0
lPos = Text0.SelStart
stFront = Left(Text0.Text, lPos)
stBack = Mid(Text0.Text, lPos + 1)
Text0.Text = stFront & Space(5) & IIf(Trim(stFront) = "", ".", "") & stBack
Text0.SelStart = lPos + 5
if trim(stFront) = "" then SendKeys "{del}"
End If
End Sub

This doesn't work for me. I debugged and see that the Text0.selstart = lPos + 5 'does not add lPos + 5 it only gives current value lPos. I also tried inserting lPos = lPos +15
before the Text0.selstart = lPos but the lPos reverts back to the current position of the cursor.

Using Access97

Thanks
kim
 

Users who are viewing this thread

Back
Top Bottom