Initialize a text box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How can I zero or set to blank a Text Box on form. On the first record it is
ok, but when I bring up another record it retains the value from the previous
record.
 
sounds like the textbox control is unbound. if that's correct, you can add a
VBA procedure to the form's Current event, to reset the control each time
you move from one record to another, as

Private Sub Form_Current()

Me!ControlName = Null

End Sub

substitute the correct name of the textbox control, of course. if you don't
know how to create an event procedure, see "Create a VBA event procedure" at
http://home.att.net/~california.db/downloads.html for illustrated
instructions.

hth
 
Bob,

It sounds like your text box is actually 'unbound' and never
got bound to any of the fields in your underlying data. This
is normal behaviour for an unbound field. You need to bind
it to a field if you want it to display the info in and
underlying field.

Look at the ControlSource on the Data tab of your properties
for the textbox. It should list a field name there. If it
doesn't click on the right side of the controlsource line
and you will get a dropdown list of fields that you can bind
to.

On the other hand, if you really are needing to manually
clear an unbound text box when you go to a new record put
the following in the OnCurrent Event of the form which fires
every time that you switch records:

Me![YourTextBoxName] = ""


Gary Miller
Sisters, OR

________________________
 
Back
Top