By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,844 Members | 1,895 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,844 IT Pros & Developers. It's quick & easy.

How to maintain cursor insertion point after DoCmd.DoMenuItem acFormBar, acFile, acSaveRecord?

P: n/a
I've got this DoCmd in a fields Change() event so that as the user types, the
underlying table (also visible in another screen...) will be updated in realtime
- instead of waiting for the screen TB closed and explicitly saving the
contents.

Only problem is that each time the DoCmd executes, I lose my insertion point.
Net effect is that after the first keystroke, the user's typing just clobbers
the first chararacter in the field over-and-over.

I guess I have to do something with .SelStart or some related property to
capture the insertion point for restoration after DoCmd has had it's way...but
what?
--
PeteCresswell
Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
RE/
but
what?


Got it...I think....at least it seems to work:
-------------------------------------------
Private Sub txtConfidentialComments_Change()
debugStackPush Me.Name & ": txtConfidentialComments_Change"
On Error GoTo txtConfidentialComments_Change_err

' PURPOSE: To keep the source field in synch with whatever the user types
' so that other screens see the updating in realtime

Dim cursorPos As Long

With Me.txtConfidentialComments
cursorPos = Me.txtConfidentialComments.SelStart
Application.RunCommand acCmdSaveRecord
.SelStart = cursorPos
End With

txtConfidentialComments_Change_xit:
debugStackPop
On Error Resume Next
Exit Sub

txtConfidentialComments_Change_err:
bugAlert True, ""
Resume txtConfidentialComments_Change_xit
End Sub
----------------------------------------------
--
PeteCresswell
Nov 13 '05 #2

P: n/a
"(Pete Cresswell)" <x@y.z> wrote in message news:<51********************************@4ax.com>. ..
I've got this DoCmd in a fields Change() event so that as the user types, the
underlying table (also visible in another screen...) will be updated in realtime
- instead of waiting for the screen TB closed and explicitly saving the
contents.

Only problem is that each time the DoCmd executes, I lose my insertion point.
Net effect is that after the first keystroke, the user's typing just clobbers
the first chararacter in the field over-and-over.

I guess I have to do something with .SelStart or some related property to
capture the insertion point for restoration after DoCmd has had it's way...but
what?


I assume you mean a control and not a field when referring to the
Change() event.

Couldn't you just use the .Text, .OldValue and .Value props to
accomplish what you need or do you actually need to save after each
typed character?

Is this so the other screen is updated as the chars are typed? Are you
refreshing the recordsource of the other screen as chars are typed?

'---------------
' John Mishefske
'---------------
Nov 13 '05 #3

P: n/a
RE/
Is this so the other screen is updated as the chars are typed? Are you
refreshing the recordsource of the other screen as chars are typed?


"Yes" and "Yes".

I think I have it nailed per previous post.
--
PeteCresswell
Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.