Results 1 to 8 of 8
  1. #1
    Join Date
    May 2004
    Posts
    73

    Question Unanswered: Help With Syntax: Cehckbox & Radio

    I have this code that works only half way, im not sure how to complete it. I want a checkbox that when ticked it the radio button is visible, then when unticked the radio button is hidden. Here is the code i have so far:

    ===========================
    Private Sub checkbox_click()
    If Me.checkbox = "true" Then
    Me.radio.Visible = "true"
    Else
    Me.radio.Visible = "false"
    End If
    End Sub
    ===========================

    Here is the problem, when I tick the checkbox the radio button dissapears. when i untick the checkbox the radio button still stays hidden. Can anyone help me with this please?

    X-Centric

  2. #2
    Join Date
    Sep 2004
    Location
    Kuala Lumpur
    Posts
    60
    Hi. Here's the longish version. I think you should put this code in the After Update Event (not On Click):

    If (Forms!MyForm!CheckBox = True) Then
    Forms!MyForm!OptionButton.Visible = True
    End If
    If (Forms!MyForm!CheckBox = False) Then
    Forms!MyForm!OptionButton.Visible = False
    End If

    wazz
    Last edited by wazz; 09-28-04 at 09:34.

  3. #3
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1

    Lightbulb

    Littel example
    Attached Files Attached Files

  4. #4
    Join Date
    May 2004
    Posts
    73
    Awesome, thanks for the fast reply. So how would I modify it for a text string in a combo box?

    I tried this but it doesnt work:

    Private Sub dropdown_AfterUpdate()
    If (Forms!Form1!dropdown = "Yes") Then
    Forms!Form1!radio.Visible = True
    End If
    If (Forms!Form1!dropdown = "No") Then
    Forms!Form1!radio.Visible = False
    End If
    End Sub

    Thanks again,

    X-Centric

  5. #5
    Join Date
    May 2004
    Posts
    73
    Nevermind I switched the event from afterupdate to onchange and it worked. But now, if I goto another form then back again the radios stay hidden. How do I make the radios stay visible or stay hidden based on whats in the record? In other words if table>record>field = =value then set radio.visible = true or something like that. Thanks.

    X-Centric
    Last edited by X-Centric; 09-28-04 at 10:41.

  6. #6
    Join Date
    May 2004
    Posts
    73
    The answer was simple! Use the same code in the oncurrent event of the form.

  7. #7
    Join Date
    Sep 2004
    Location
    Kuala Lumpur
    Posts
    60
    Nice.
    wazz

  8. #8
    Join Date
    Sep 2004
    Location
    Kuala Lumpur
    Posts
    60
    btw: did u check out the attached .db from hammbakka? very nice (not sure it's quite what u need...?). AND u can practice ur German!

Posting Permissions

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