467,910 Members | 1,644 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,910 developers. It's quick & easy.

Save Contents of Unbound Field

Access 97 - I have a form with a single unbound text field. I want to have a
timer event which periodically saves the contents of that field. But I
noticed that if the focus stays on the field then then the text doesn't get
saved. It's like the text isn't there until focus is moved off the field.

So does anyone know how to grab the contents of an "uncommitted" field
without moving the focus?

By the way, I tried moving the focus away, saving, then moving back, which
works except that at the end of this all the text is highlighted, which
means the next character typed wipes everything !!

Hope this makes sense
Dave
Nov 12 '05 #1
  • viewed: 2040
Share:
2 Replies
You'll need to refer to the Text property of the control instead of the
Value property (which is the default property). The Text property is only
accessible when the control has the focus, so you may still have to deal
with the selection issue, but you can do that by using the SelStart
property. The following example is untested, from memory, but should
hopefully serve to point you in the right direction ...

Dim txt As Textbox
Dim strTheText as String

Set txt = Forms!NameOfForm!NameOfTextBox
With txt
.SetFocus
strTheText = .Text
.SelStart = Len(.Text)
End With

--
Brendan Reynolds
"Dave Griffiths" <da**@k2computers.co.uk> wrote in message
news:c0*******************@news.demon.co.uk...
Access 97 - I have a form with a single unbound text field. I want to have a timer event which periodically saves the contents of that field. But I
noticed that if the focus stays on the field then then the text doesn't get saved. It's like the text isn't there until focus is moved off the field.

So does anyone know how to grab the contents of an "uncommitted" field
without moving the focus?

By the way, I tried moving the focus away, saving, then moving back, which
works except that at the end of this all the text is highlighted, which
means the next character typed wipes everything !!

Hope this makes sense
Dave

Nov 12 '05 #2
How are you saving the value? An unbound field would require an external
method of writing it's value. If you are depending on the form to do this,
then nothing will happen.

Mike Storr
www.veraccess.com
"Dave Griffiths" <da**@k2computers.co.uk> wrote in message
news:c0*******************@news.demon.co.uk...
Access 97 - I have a form with a single unbound text field. I want to have a timer event which periodically saves the contents of that field. But I
noticed that if the focus stays on the field then then the text doesn't get saved. It's like the text isn't there until focus is moved off the field.

So does anyone know how to grab the contents of an "uncommitted" field
without moving the focus?

By the way, I tried moving the focus away, saving, then moving back, which
works except that at the end of this all the text is highlighted, which
means the next character typed wipes everything !!

Hope this makes sense
Dave

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Andras Gilicz | last post: by
1 post views Thread by Stephan | last post: by
4 posts views Thread by Rick Thiel | last post: by
3 posts views Thread by Dos Lil | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.