473,406 Members | 2,713 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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

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
3 3108
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
"(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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: deko | last post by:
I'm trying to expand a popup form and make additional controls available by making the form footer visible and resizing the form. This works: Me.FormFooter.Visible = Me!tglAdvanced.Value...
2
by: anonymous | last post by:
is there a way to surpress the insertion cursor in a rich text box? for instance, i might want a RichTextBox to display some text as a Label would-- readonly, no insertion cursor though text...
2
by: DaveR | last post by:
Can anybody help me to a)get the user's cursor insertion point (caret) from a multiline textbox, using client-side script I suppose, and then b)return the position to VB code behind? I have...
0
by: Mehina | last post by:
i am having a problem regarding the disappearance of the cursor in the DataGrid cell after i change the width of the column on runtime.here is a function which is being called in the Textchanged...
2
by: Jassim Rahma | last post by:
how can i change the cursor of the textbox to the block style?
3
by: Klaus Brune | last post by:
Hello all, When one tabs through a form (specifically, in Firefox), all the text in a field is automatically selected. What I'm looking for is a way to put a function (in onFocus perhaps)...
5
by: phill86 | last post by:
Hi I have a main form that holds records for scheduled meetings, date time location etc... in that form i have a sub form that has a list of equipment resources that you can assign to the meeting in...
3
by: cm5th | last post by:
I understand Access lets the VBA statements following a DoCmd statement execute before a DoCmd has completed. I have a situation where I use a DoCmd.DoMenuItem (copied from the UNDO button VBA) to...
4
by: gazza10001 | last post by:
Hi i hope you can help my company uses access and has modified for its needs usually what happens is you serach for the invoice by its number and then it brings all the information up such as...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.