How to output string to textbox based on criteria

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fgvieira
    New Member
    • Feb 2013
    • 1

    #1

    How to output string to textbox based on criteria

    I am very new to access and VBA so please excuse the idiocracy of the question, but, I'm trying to output a string to a bound textbox in a form based on the value of a calculated textbox. So here's what I have so far, and it works in that if I say debug.print it prints to the immediate box but it won't output to the textbox in the form.

    Code:
    Private Sub LowReg_Click()
    
    Dim output As String
    Dim ctlLowReg As Control
    
        If [Low Registration Raw] <= 18 Then
             output = "--"
        ElseIf [Low Registration Raw] <= 26 Then
             output = "-"
        ElseIf [Low Registration Raw] <= 40 Then
            output = "="
        ElseIf [Low Registration Raw] <= 51 Then
            output = "+"
        ElseIf [Low Registration Raw] <= 75 Then
             output = "++"
             
    End If
    
    End Sub
    LowRegistration Raw is a calculated field, and I'd like the field LowReg, which also appears as a textbox, to show either "--", "-", "=", "+", or "++" depending on the value of Low Registration Raw.

    Thanks!
    Last edited by Rabbit; Feb 28 '13, 04:36 AM. Reason: Please use code tags when posting code.
  • Seth Schrock
    Recognized Expert Specialist
    • Dec 2010
    • 2965

    #2
    Replace your Output with Me.textbox_name.

    Comment

    Working...