Works like a charm - thank you MVP\ wrote:
[Quoted Text] >You can't do this in a report, so I assume that you want to do it in a form? > >One way is to use the AfterUpdate event of the textbox to add the trailing >text to whatever the user enters: > >Private Sub TextBoxName_AfterUpdate() >Const strAddText As String = "-B/O" >If Right(Me.TextBoxName.Value, Len(strAddText)) <> strAddText Then _ > Me.TextBoxName.Value = Me.TextBoxName.Value & strAddText >End Sub > > >Or you can put the default text in the textbox and then position the cursor >to the left of the first character, using the GotFocus event of the textbox: > >Private Sub TextBoxName_GotFocus() >Const strAddText As String = "-B/O" >If Len(Me.TextBoxName.Value & "") = 0 Then > Me.TextBoxName.Value = strAddText > Me.TextBoxName.SelStart = 0 > Me.TextBoxName.SelLength = 0 >End If >End Sub >
|