Results 1 to 15 of 15
  1. #1
    islandboy is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Jun 2009
    Posts
    63

    hide text box till you un-tick check box

    hello guys.



    i saw a function that hides a text box till you click on the option button.

    i would like to hide a text box till you un-tick the check box.

    can it be done that way?

    thanks

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Use the Click event of the CheckBox and the Visible property of the TextBox.

  3. #3
    islandboy is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Jun 2009
    Posts
    63
    can you help me more with that, i tried puting that on click but i dosn't work.

    i want the text box of another field to remain hiden until i remove the tick from the box.

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    What did you put in the Click event of the CheckBox? Post it here.

  5. #5
    islandboy is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Jun 2009
    Posts
    63
    ok...i got it to work partially

    it hides the text box when i tick the box but it won't show it again when i un-tick the box

    here is what i did On Click:

    Private Sub Active_Click()
    Label409.Visible = False
    Leave_Date.Visible = False

    End Sub



    i also added the db that i saw that option.

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I use the Me. reference so that IntelliSense can help with the spelling. If Label409 is attached to the Leave_Date control then its visibility will follow the other control. Change your code to something like:
    Code:
    Private Sub Active_Click()
       If Active Then
          Leave_Date.Visible = True
       Else
          Leave_Date.Visible = False
       End If
    End Sub
    You are also going to want similar code in the Current Event of the form.

  7. #7
    islandboy is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Jun 2009
    Posts
    63
    its working but i still have a problem that that field remais visible till you click on the tick box.
    maybe a need to do that on the form like you said.

    i can just add the same code on the form or i need to change it??

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Same code in the Current event of the form.

  9. #9
    islandboy is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Jun 2009
    Posts
    63
    i am using Tabs on my form...i don't see the current form. can you help me on that?

    ok i got on current on the form..but it give me a debug error when it gets on the blank last record. Run-Time error '94: Invalid use of Null

    Private Sub Form_Current()

    If Active Then
    Leave_Date.Visible = False
    Else
    Leave_Date.Visible = True
    End If
    End Sub

  10. #10
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Then wrap the code in:
    If Not Me.NewRecord Then
    'current code
    End If

  11. #11
    islandboy is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Jun 2009
    Posts
    63
    Quote Originally Posted by RuralGuy View Post
    Then wrap the code in:
    If Not Me.NewRecord Then
    'current code
    End If
    if i put that on the current form it won't keep the text box visible. when you re-open the form.

  12. #12
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Post how you wrapped the code in the test.

  13. #13
    islandboy is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Jun 2009
    Posts
    63
    Quote Originally Posted by RuralGuy View Post
    Post how you wrapped the code in the test.
    Private Sub Form_Current()

    If Active Then
    If Not Me.NewRecord Then

    Leave_Date.Visible = False
    Else
    Leave_Date.Visible = True
    End If
    End Sub

  14. #14
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Backwards:
    Code:
    Private Sub Form_Current()
       If Not Me.NewRecord Then
          If Active Then
             Leave_Date.Visible = False
          Else
             Leave_Date.Visible = True
          End If
       End If
    End Sub
    You need to use the code tags so your indenting is preserved. You also missed an End If in the code.

  15. #15
    islandboy is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Jun 2009
    Posts
    63
    thanks for all the hepl mate it work perfectly.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Cannot hide fields in a datasheet
    By desgordon in forum Forms
    Replies: 2
    Last Post: 08-19-2009, 03:24 PM
  2. Hide/UnHide forms
    By access in forum Forms
    Replies: 3
    Last Post: 06-03-2009, 07:48 AM
  3. how to hide the fields in subform
    By tinytree in forum Forms
    Replies: 3
    Last Post: 05-01-2009, 07:56 AM
  4. Show Hide Subreport / acViewReport
    By BigBear in forum Reports
    Replies: 4
    Last Post: 03-30-2009, 06:07 AM
  5. Hide the Database window
    By wasim_sono in forum Access
    Replies: 5
    Last Post: 02-02-2006, 06:41 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums