text box contents?

  • Thread starter Thread starter m.h.dashper
  • Start date Start date
M

m.h.dashper

In Access 2002, how can I access, in code, the contents of a text box
on a form before the data has been committed?
I can get/set the insertion point using textBoxName.SelStart but
textBoxName.Value doe not reflect the contents of the box until focus
is moved elsewhere.

Martin Dashper
 
Martin,

Reading between the lines, I feel you may be under a misapprehension.
Apologies if I have misunderstood. The data is not "committed" until
the *record* is saved, which probably has nothing to do with whether
the focus has moved on from your textbox.

- Steve Schapel, Microsoft Access MVP
 
Martin,

Reading between the lines, I feel you may be under a misapprehension.
Apologies if I have misunderstood. The data is not "committed" until
the *record* is saved, which probably has nothing to do with whether
the focus has moved on from your textbox.

- Steve Schapel, Microsoft Access MVP
OK, Steve, I guess I was a bit loose in my jargon, but the fundamental
question of how to keep continuous track of the contents of a text box
in code during the process of data entry remains.

At the moment, I am creating a shadow copy of the text box in a
buffer, updating it in response to KeyPress and KeyDown events, but
that seems messy and hopefully unnecessary, and gets quite complicated
when it comes to taking note of the states of the Delete and Insert
keys!

Martin.
 
Hi,


Me.ControlName.Value variant, is the last value committed at the
control level

Me.ControlName.OldValue variant, is the last value committed at the
table level

Me.ControlName.Text string, is the text as being currently modified by
the user while typing in it. Only available for the control having the
focus, evidently, from the definition. You can also use SelText and
associated functions and SelLength to select part of the Text.

Me.ControlName.DefaultValue string, is the value that will be
proposed to the user if a new record is created.

Me.ControlName.Undo method, reverse the modification bring to that
control (a little bit like specifying .value = .oldvalue), like a single Esc
key.

Me.Undo method, rollback the whole record modification ( like a
double-Esc ), undoing all the records and undoing the Dirty-ness




Hoping it may help,
Vanderghast, Access MVP
 
Hi,


I failed my "Cut and paste - 101" certificate, over and over, that should
explain why you should have read, but didn't:

You can also use SelText and
associated functions *SelStart* and SelLength to select part of the
Text.


Vanderghast, Access MVP
 
Back
Top