Results 1 to 9 of 9

Thread: TextBox

  1. #1
    Join Date
    Apr 2004
    Posts
    17

    Question Unanswered: TextBox

    I have 2 textboxes for entering a start search date and an end date, but the function behind them is only triggered if a certain checkbox is clicked. is there a way besides "GotFocus" and "LostFocus" that i can make those txtboxes appear and disapper according to the checkbox ?
    I hope i explained it

  2. #2
    Join Date
    Apr 2004
    Location
    South Arica
    Posts
    125
    You can use the click event of the check box, or the form_current. form_current is only fired when the user moves from record to record though.

  3. #3
    Join Date
    Apr 2004
    Posts
    17
    Originally posted by Saila
    You can use the click event of the check box, or the form_current. form_current is only fired when the user moves from record to record though.

    I tried that, but no luck, i'm trying to do it in code see if i can come up with something

  4. #4
    Join Date
    Apr 2004
    Location
    South Arica
    Posts
    125
    How were you trying to do it, if not through code?

  5. #5
    Join Date
    Jan 2004
    Location
    Toronto, Canada
    Posts
    259
    On the On_Click event of the checkbox,

    If Me.Value = True then
    Textbox1.Visible = True
    Textbox2.Visible = False
    Else
    Textbox1.Visible = False
    Textbox2.Visible = False
    End if

  6. #6
    Join Date
    Apr 2004
    Location
    South Arica
    Posts
    125
    Me refers to the form, not the current control.
    Code:
    Private Sub Check1_Click()
        If Check1 = True Then
           Text1.Visible = True
           Text2.Visible = Flase
        Else
           Text1.Visible = False
           Text2.Visible = Flase
        End If
    End Sub

  7. #7
    Join Date
    Jan 2004
    Location
    Toronto, Canada
    Posts
    259
    Sry, its supposed to be Me.Check0.Value = True...

  8. #8
    Join Date
    Apr 2004
    Posts
    17
    Originally posted by Saila
    Me refers to the form, not the current control.
    Code:
    Private Sub Check1_Click()
        If Check1 = True Then
           Text1.Visible = True
           Text2.Visible = Flase
        Else
           Text1.Visible = False
           Text2.Visible = Flase
        End If
    End Sub
    THANKS guys, i have been working at this trying to make something else work and i didnt reialize how easy it is until you pointed it out.

    you do want to change the 2nd line of code, becuase its going to give you an error ----->


    Private Sub Check1_Click()
    If Check1.value = (anything but 0, depends on what access u are using) Then
    Text1.Visible = True
    Text2.Visible = True
    Else
    Text1.Visible = False
    Text2.Visible = Flase
    End If
    End Sub

  9. #9
    Join Date
    Jan 2004
    Location
    Toronto, Canada
    Posts
    259
    regadless of the version of access, in VBA, if checkbox = true, it means -1 and checkbox = false, its 1...

    its safer to go with bools than ints in VBA..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •