Results 1 to 7 of 7
  1. #1
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496

    Option Group - change radio buttons on click

    I'm using an option group to change textboxes control source and labels (this is working fine)



    I am using

    Code:
    Private Sub Option74_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Me.txtSchoolEmail.ControlSource = "[3DramaEmail]"
    Me.Label29.Caption = "Drama Teacher Email"
    Me.Requery
    End Sub
    However - when I have made the selection - the radio button doesn't appear pressed/selected.

    I am guessing the on mouse down event is not enough?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Try the Option Group control AfterUpdate event.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Quote Originally Posted by June7 View Post
    Try the Option Group control AfterUpdate event.
    Not sure what is wrong

    I am using


    Private Sub Frame63_AfterUpdate()
    If Me.Option66.Enabled = True Then
    Me.txtSchoolEmail.ControlSource = "[1ContactEmail]"
    Me.Label29.Caption = "Contact Email"
    Me.Requery
    ElseIf Me.Option68.Enabled = True Then
    Me.txtSchoolEmail.ControlSource = "[6EnglishEmail]"
    Me.Label29.Caption = "English Teacher Email"
    Me.Requery
    ElseIf Me.Option70.Enabled = True Then
    Me.txtSchoolEmail.ControlSource = "[2LibrarianEmail]"
    Me.Label29.Caption = "Librarian Email"
    Me.Requery
    ElseIf Me.Option72.Enabled = True Then
    Me.txtSchoolEmail.ControlSource = "[4MusicEmail]"
    Me.Label29.Caption = "Music Teacher Email"
    Me.Requery
    ElseIf Me.Option74.Enabled = True Then
    Me.txtSchoolEmail.ControlSource = "[3DramaEmail]"
    Me.Label29.Caption = "Drama Teacher Email"
    Me.Requery
    ElseIf Me.Option76.Enabled = True Then
    Me.txtSchoolEmail.ControlSource = "[5WelfareEmail]"
    Me.Label29.Caption = "Welfare Teacher Email"
    Me.Requery
    ElseIf Me.Option78.Enabled = True Then
    Me.txtSchoolEmail.ControlSource = "[SchoolEmail]"
    Me.Label29.Caption = "School Email"
    Me.Requery
    End If
    however it doesn't work...

    I am guessing if optiongroup value = 1 then

    Code:
    If Me.Frame63.Value = 1 Then
    Me.txtSchoolEmail.ControlSource = "[1ContactEmail]"
    Me.Label29.Caption = "Contact Email"
    Me.Requery
    ElseIf Me.Frame63.Value = 2 Then
    Me.txtSchoolEmail.ControlSource = "[6EnglishEmail]"
    Me.Label29.Caption = "English Teacher Email"
    Me.Requery
    ElseIf Me.Frame63.Value = 3 Then
    Me.txtSchoolEmail.ControlSource = "[2LibrarianEmail]"
    Me.Label29.Caption = "Librarian Email"
    Me.Requery
    ElseIf Me.Frame63.Value = 4 Then
    Me.txtSchoolEmail.ControlSource = "[4MusicEmail]"
    Me.Label29.Caption = "Music Teacher Email"
    Me.Requery
    ElseIf Me.Frame63.Value = 5 Then
    Me.txtSchoolEmail.ControlSource = "[3DramaEmail]"
    Me.Label29.Caption = "Drama Teacher Email"
    Me.Requery
    ElseIf Me.Frame63.Value = 6 Then
    Me.txtSchoolEmail.ControlSource = "[5WelfareEmail]"
    Me.Label29.Caption = "Welfare Teacher Email"
    Me.Requery
    ElseIf Me.Frame63.Value = 7 Then
    Me.txtSchoolEmail.ControlSource = "[SchoolEmail]"
    Me.Label29.Caption = "School Email"
    Me.Requery
    End If
    that works however the radio buttons don't

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Neither do I, they always work for me.

    BTW, Select Case construct would be ideal for that conditional code.

    Not sure you need the Requery lines. The RecordSource has not be altered.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Solved

    used

    Code:
    Select Case Me.Frame63
    Case 1
    Me.txtSchoolEmail.ControlSource = "[1ContactEmail]"
    Me.Label29.Caption = "Contact Email"
    Me.Requery
    Case 2
    Me.txtSchoolEmail.ControlSource = "[6EnglishEmail]"
    Me.Label29.Caption = "English Teacher Email"
    Me.Requery
    Case 3
    Me.txtSchoolEmail.ControlSource = "[2LibrarianEmail]"
    Me.Label29.Caption = "Librarian Email"
    Me.Requery
    Case 4
    Me.txtSchoolEmail.ControlSource = "[4MusicEmail]"
    Me.Label29.Caption = "Music Teacher Email"
    Me.Requery
    Case 5
    Me.txtSchoolEmail.ControlSource = "[3DramaEmail]"
    Me.Label29.Caption = "Drama Teacher Email"
    Me.Requery
    Case 6
    Me.txtSchoolEmail.ControlSource = "[5WelfareEmail]"
    Me.Label29.Caption = "Welfare Teacher Email"
    Me.Requery
    Case 7
    Me.txtSchoolEmail.ControlSource = "[SchoolEmail]"
    Me.Label29.Caption = "School Email"
    Me.Requery
    End Select

  6. #6
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Quote Originally Posted by June7 View Post
    Neither do I, they always work for me.

    BTW, Select Case construct would be ideal for that conditional code.
    Was about to update but you were too quick!

    Cheers and thankyou

  7. #7
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Quote Originally Posted by June7 View Post
    Not sure you need the Requery lines. The RecordSource has not be altered.
    yeah, I just took those out - thanks

    wasn't sure how the option group would handle it.

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

Similar Threads

  1. Replies: 4
    Last Post: 07-08-2013, 03:46 PM
  2. Radio buttons within Option Group not working
    By losingmymind in forum Programming
    Replies: 7
    Last Post: 01-09-2013, 03:09 PM
  3. Replies: 6
    Last Post: 07-20-2011, 11:54 AM
  4. Working with Radio Buttons and Option Groups
    By queenbee in forum Access
    Replies: 1
    Last Post: 04-29-2011, 02:25 PM
  5. option group radio buttons
    By ManC in forum Forms
    Replies: 9
    Last Post: 03-08-2010, 03:46 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