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

Save Contents of Unbound Field

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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.