Unbound controls (textboxes, specifically)

  • Thread starter Thread starter Pwyd
  • Start date Start date
P

Pwyd

Is there a default behaviour to set somewhere so that unbound controls with
no row source will clear upon moving the view to a different record?

If thats something that should be set on a control-by-control basis, in
which manner would you do so? (programattically or otherwise)
 
Is there a default behaviour to set somewhere so that unbound controls with
no row source will clear upon moving the view to a different record?

If thats something that should be set on a control-by-control basis, in
which manner would you do so? (programattically or otherwise)

There is nothing you can set on the control, but on the OnCurrent
event of your form you can reset the TextBox value.

Private Sub Form_Current()
If Me.Text2.ControlSource = "" Then
Me.Text2 = ""
End If
End Sub

Keven Denen
 
Hi,

To do all unbound text boxes:

Private Sub Form_Current()

Dim ctrl As Control

For Each ctrl In Controls
If ctrl.ControlType = acTextBox Then
If ctrl.ControlSource = "" Then
ctrl.Value = Null
End If
End If
Next ctrl

End Sub


Clifford Bass
 
Great, thank you both.



Clifford Bass said:
Hi,

To do all unbound text boxes:

Private Sub Form_Current()

Dim ctrl As Control

For Each ctrl In Controls
If ctrl.ControlType = acTextBox Then
If ctrl.ControlSource = "" Then
ctrl.Value = Null
End If
End If
Next ctrl

End Sub


Clifford Bass
 
Back
Top