Results 1 to 2 of 2
  1. #1
    AussieGal is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    56

    Only allow values dependant on other box

    Hi,



    I have a form that has combo that should only be able to be entered into dependant on another combo box's value.
    eg If users select 514 from the first combo (cmbProCode), then they can enter into CoStaff field which is also a combo box. I want it so if 514 is not in the cmbprocode field, then costaff should be blank. I am fine with a message box popping up if this criteria is not met, yet I was trying with enabled and wasn't getting far. These combo boxs are on a continuous sub form.

    This is what I was trying, without success.
    Code:
    Private Sub CoStaff_BeforeUpdate(Cancel As Integer)
        If Me.cmbProCode.Value = 514 Then
            Me.CoStaff.Enabled = True
            Else: Me.CoStaff.Enabled = False
        End If
    End Sub

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Setting this property by code will affect all instances of the control.

    Enabled state can be managed with criteria in Conditional Formatting.
    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.

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

Similar Threads

  1. Time dependant disable edits
    By ErinMcArthur in forum Security
    Replies: 1
    Last Post: 11-09-2012, 02:42 PM
  2. Dependant Variables and autofill
    By dukati7 in forum Access
    Replies: 1
    Last Post: 06-14-2012, 01:30 PM
  3. Replies: 1
    Last Post: 03-22-2010, 03:37 PM
  4. Replies: 6
    Last Post: 02-28-2010, 05:46 PM
  5. Continuous Subforms Filter Dependant Combo
    By BigBear in forum Forms
    Replies: 0
    Last Post: 04-19-2009, 08:13 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