-----Original Message-----
Context:
I am using a "Tab" control. When the user enters
the "Tab", I set the TextBox Text to zero length strings.
This clear routine works fine the first time. When the
user changes an option selection on the "Tab", I clear out
any old data before filling the TextBoxes with the
selection related data. When I run this clear routine the
second time, I receive the 2115 run time error. All the
TextBoxes are "Unbound". The clear routine is in a module
with the following code;
Sub Clear_Lst()
Forms![frmMain].Controls!txtListName.SetFocus
Forms![frmMain].Controls!txtListName.Text = ""
Forms![frmMain].Controls!txtCommentsL.SetFocus
Forms![frmMain].Controls!txtCommentsL.Text = ""
Forms![frmMain].Controls!txtEntryIDL.SetFocus
Forms![frmMain].Controls!txtEntryIDL.Text = ""
End Sub
In general you should not be setting the Text property, use
the Value property instead. In this case, I suspect that
your validation code is complaining about a ZLS. This
happens because setting the Text property causes the text
box's Before and After Update events to fire (not to mention
the GotFocus event).
Setting the Value property (almost always the right way to
do this) does not cause those events to fire so your code
can proceed without interference.
Unless you have a good reason, it is more common to set the
values to Null rather than ""
Sub Clear_Lst()
Forms![frmMain].txtListName = Null
Forms![frmMain].txtComments = Null
Forms![frmMain].txtEntryIDL = Null
End Sub