• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 327
  • Last Modified:

Texbox Display another textboxes text

Access 2000
win 2000 sp4

What I have:

I have a form with 72 textboxes starting at Text0  to Text71

What I need:
I want another textbox (txtDisplay) on the form,  to display the contents from what Ever the current textbox is that has the focus.

But , only the textboxes from Text0  to Text71... will be displayed in txtDisplay.


2 Solutions
Jeffrey CoachmanMIS LiasonCommented:
You could try something like this:

Put the following code on ALL of you textboxes:

Private Sub Text0_GotFocus()
    If IsNull(Me.Text0) Then
        txtDisplay = "The Selected Field is empty"
        txtDisplay = [Text0]
    End If
End Sub

(Of course, changing the text box names for each one)

Set the Tab stop Property of "txtDisplay" to "No"
(So you can't "Tab" into "txtDisplay")

Apply conditional formatting to "txtDisplay" that is:
Condition1: If FieldValue is, Equal to, "The Selected Field is empty" (Set the Font color to Red)

This is a "Brute Force" solution, but I tested it and it works!

Give it a try!
You can also use the form Timer event to populate the text box based on the active control.
It's a bit choppy, but it works.

Private Sub Form_Timer()
    Dim ctl As Control
    Dim strText As String
    Set ctl = Me.ActiveControl
    If TypeOf ctl Is TextBox Then
        If ctl.Name <> "txtDisplay" Then
            strText = ctl.Text
            Me.TimerInterval = 5000
            txtDisplay.Text = strText
            Me.TimerInterval = 500
        End If
    End If
End Sub

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now