Results 1 to 3 of 3
  1. #1
    sonntagc is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2014
    Posts
    13

    Use an Option Group with 2 Toggle options to control ability to edit other fields on the same form.

    Hello. new to this forum. i have a form where i have created a 2-value toggle control ("optFindMethod"). the 2-value options show as toggle buttons("tglFindMethBatchRef" and "tglFindMethZrteID"), with option values of 1 and 2 respectively. if the user selects option 1, i want to turn on edit ability of some fields that are specific to search method 1 AND turn off fields that are specific to search method 2. the code kind of works, but i always seem to be able to get into some fields and not others. also, not sure the best place to do the "checking".

    the "cbo" fields are combo boxes, that i allow user selection of some data. eventually, i want to add some additional fields related to each search method.

    Code:
    Private Sub SetFindMethod()
        'optFindMethod is an option group
        '  value 1 is search by QicLink Batch/Ref Num
        '  value 2 is search by ZRTE Master Claim ID
        '
    
        If Me.optFindMethod = 1 Then
            'batch ref num search true
            Me.cboQLBtchRef.Locked = False
            Me.cboQLBtchRef.TabStop = True
            Me.cboQLBtchRef.Enabled = True
            Me.cboQLBtchRef.SpecialEffect = 2
        
            'zrte id search false
            Me.cboZrteID.Locked = True
            Me.cboZrteID.TabStop = False
            Me.cboZrteID.Enabled = False
            Me.cboZrteID.SpecialEffect = 2
            
        ElseIf Me.optFindMethod = 2 Then
            'zrte id search true
            Me.cboZrteID.Locked = False
            Me.cboZrteID.TabStop = True
            Me.cboZrteID.Enabled = True
            Me.cboZrteID.SpecialEffect = 0
            
            'batch ref num search false
            Me.cboQLBtchRef.Locked = True
            Me.cboQLBtchRef.TabStop = False
            Me.cboQLBtchRef.Enabled = False
            Me.cboQLBtchRef.SpecialEffect = 2
        Else
            Beep
            MsgBox "Something is Wrong with FIND METHOD settings ... "
        End If
        Me.Repaint
        DoEvents
    End Sub
    Private Sub tglFindMethBatchRef_KeyUp(KeyCode As Integer, Shift As Integer)
        Call SetFindMethod
    End Sub
    Private Sub tglFindMethBatchRef_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
        Call SetFindMethod
    End Sub
    Private Sub tglFindMethZrteID_KeyUp(KeyCode As Integer, Shift As Integer)
        Call SetFindMethod
    End Sub
    Private Sub tglFindMethZrteID_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
        Call SetFindMethod
    End Sub



    any help in steering me in the right direction would be appreciated

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    I use OptionGroup Click event.

    Try setting the toggle values to -1 and 0 (True and False) - True to use QLBtchRef and False for ZrteID
    Code:
    With Me
            .cboQLBtchRef.Locked = Not .optFindMethod
            .cboQLBtchRef.TabStop = .optFindMethod
            .cboQLBtchRef.Enabled = .optFindMethod
            .cboQLBtchRef.SpecialEffect = IIf(.optFindMethod = True, 2, 0)
            .cboZrteID.Locked = .optFindMethod
            .cboZrteID.TabStop = Not .optFindMethod
            .cboZrteID.Enabled = Not .optFindMethod
            .cboZrteID.SpecialEffect = IIf(.optFindMethod = False, 2, 0)
    End With
    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
    sonntagc is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2014
    Posts
    13
    THANKS. that's exactly what i needed. works like a charm.

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

Similar Threads

  1. Replies: 2
    Last Post: 12-10-2013, 04:23 PM
  2. Control Button to toggle edit mode
    By Leonidsg in forum Programming
    Replies: 2
    Last Post: 03-19-2013, 06:53 PM
  3. Replies: 9
    Last Post: 05-29-2012, 11:03 AM
  4. Replies: 6
    Last Post: 09-27-2011, 04:39 PM
  5. Toggle Button Options
    By Matthieu in forum Forms
    Replies: 2
    Last Post: 11-23-2009, 04:05 PM

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