craigachan
Registered User.
- Local time
- Today, 05:54
- Joined
- Nov 9, 2007
- Messages
- 285
I'm having trouble understanding what is going on.
I have:
Form - TestForm
Fields: Note, PreNote, PostNote, and cursorposition
I have the following code:
When I type in new text to Me.Note, I notice that Me.Cursorposition keeps pace with my cursor. But PreNote and PostNote do not update until I move out of the field and then go back to Me.Note and then add something.
I'm trying to get Me.PreNote and Me.PostNote to update each time I add a character to Me.Note. I'll use the results of Pre and Post to insert text in Me.Note later.
Can anyone tell me what is happening and how I can make this work the way I want? Thank you.
I have:
Form - TestForm
Fields: Note, PreNote, PostNote, and cursorposition
I have the following code:
Code:
Option Compare Database
Option Explicit
Private Sub cmdClear_Click()
cursorposition = Null
PreNote = Null
PostNote = Null
Note = Null
End Sub
Private Sub Note_Change()
Dim cp As Integer
cp = Me.Note.SelStart
Me.cursorposition = Me.Note.SelStart
Me.PreNote = Mid(Me.Note, 1, cp)
Me.PostNote = Mid(Me.Note, cp + 1)
End Sub
Private Sub Note_GotFocus()
Dim cp As Integer
cp = Me.Note.SelStart
Me.cursorposition = Me.Note.SelStart
End Sub
When I type in new text to Me.Note, I notice that Me.Cursorposition keeps pace with my cursor. But PreNote and PostNote do not update until I move out of the field and then go back to Me.Note and then add something.
I'm trying to get Me.PreNote and Me.PostNote to update each time I add a character to Me.Note. I'll use the results of Pre and Post to insert text in Me.Note later.
Can anyone tell me what is happening and how I can make this work the way I want? Thank you.