473,323 Members | 1,537 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,323 software developers and data experts.

How to restore cursor position after acSaveRecord?

Right now, as the user types I'm invoking this code in the field's Change event:
-----------------
With theField
cursorPos = .SelStart
Application.RunCommand acCmdSaveRecord
.SelStart = cursorPos
End With
-----------------

The idea is that there may be a floater window open that's linked to the same
field and I want the user's typing to show up immediately in both windows.

The code above works...sort of.... but it seems TB swallowing SpaceBars. i.e.
If somebody types "xyz" it works OK. But if somebody types "x y z", what gets
to the field is only "xyz".

I tried .SelStart = cursorPos + 1, but it didn't help...seems like the spaces
just aren't there at that time...yet amphamerics are...

?
--
PeteCresswell
Nov 13 '05 #1
2 3140
When you ask Access to save the record, it also finalizes the field edit.
Access trims trailing blanks from data entered by hand into a field, so the
space character is lost. I think you will have to cache the value of the
field's Text property before the acCmdSaveRecord, then use the field's
AfterUpdate handler to re-write it to the control.

Another option would be to update the floater window differently so that you
can use the Text property to update the floating window (floater sounds like a
corpse to me <g>) immediately rather than having to save the entire record.

On Mon, 20 Dec 2004 00:18:46 GMT, "(Pete Cresswell)" <x@y.z> wrote:
Right now, as the user types I'm invoking this code in the field's Change event:
-----------------
With theField
cursorPos = .SelStart
Application.RunCommand acCmdSaveRecord
.SelStart = cursorPos
End With
-----------------

The idea is that there may be a floater window open that's linked to the same
field and I want the user's typing to show up immediately in both windows.

The code above works...sort of.... but it seems TB swallowing SpaceBars. i.e.
If somebody types "xyz" it works OK. But if somebody types "x y z", what gets
to the field is only "xyz".

I tried .SelStart = cursorPos + 1, but it didn't help...seems like the spaces
just aren't there at that time...yet amphamerics are...

?


Nov 13 '05 #2
The problem is that when Access saves the record, it will trim any trailing
spaces. One way around this would be to not save if the last character was a
space. Another way would be to have a Static variable in the routine to
"remember" what was actually in the box and when the next non-space is
typed, have it replace everything. Either way, you won't get "A " showing up
in your other form.

What are you trying to do that you need to force the updates onto the other
form like this?

--
Wayne Morgan
Microsoft Access MVP
"(Pete Cresswell)" <x@y.z> wrote in message
news:3i********************************@4ax.com...
Right now, as the user types I'm invoking this code in the field's Change
event:
-----------------
With theField
cursorPos = .SelStart
Application.RunCommand acCmdSaveRecord
.SelStart = cursorPos
End With
-----------------

The idea is that there may be a floater window open that's linked to the
same
field and I want the user's typing to show up immediately in both windows.

The code above works...sort of.... but it seems TB swallowing SpaceBars.
i.e.
If somebody types "xyz" it works OK. But if somebody types "x y z", what
gets
to the field is only "xyz".

I tried .SelStart = cursorPos + 1, but it didn't help...seems like the
spaces
just aren't there at that time...yet amphamerics are...

?
--
PeteCresswell

Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: SD | last post by:
Hi, Quick question, I have about 20 users in my local server and database. We are looking to restore that database to a new server in a new network and still be able to retain the database...
0
by: barbara | last post by:
I am using this procedure from net for getting the restore script. It lists the latest full backup file name and logs after that point. Is there any way to modify this script to take either date...
1
by: Dan H. | last post by:
Hello, I want to try to retrieve the cursor position x and y relative to the form the cursor is over. The way I am doing it now is: 1. Retrieve the left and top position of the form relative...
1
by: Tantra Veda | last post by:
Hello C# gurus, I have a question about finding cursor position in NumericUpDown control. On my form I have a numericUpDown control with 2 decimal places. I want to increment value in the numeric...
1
by: objectref | last post by:
Hi to all, we have the MousePosition property that we can get the Point of the position of the mouse cursor on the screen, but is it there a way to get the respective Point of a cursor in a...
1
by: Paul | last post by:
Hi all, I am making a DirectInput application wich must report correctly the cursor position in windowed mode (it means it has to be the same as Microsoft Window´s cursor position). First of...
22
by: DraguVaso | last post by:
Hi, For my application I need the following behavior: When I press F4 the cursor has to move to the next line in my multiline textbox which begins with "0". Finding lines starting with 0 isn't...
0
by: Mirover | last post by:
how can I use the "result set " (fill a temp table) with the returned result set of querys like this : restore filelistonly,restore headeronly...
4
by: mike | last post by:
I have the opportunity to rescue a project that uses a mouse to sense the relative position of a machine. The hardware is built...just needs to be programmed. Stop snickering!!! I didn't do it...I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.