Results 1 to 7 of 7
  1. #1
    MSAccessOldTimer is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    May 2012
    Posts
    46

    Combo Box Filtered based on Control Value

    I have a control form [type] on a form B. The value is tied to a selection made on Form A. Works great. I have a combo box [Requirement] on Form B that contains multiple selections. Not all of the selections are valid for each [Type]. There are three different "types" possible. Within the table (query) feeding the combox box, I added a field entitiled "code"

    tblCombo Box
    ID
    Requirement (text field)
    Code (number field) Codes numbers 1, 2 or 3 are assigned to each "Requirement"

    On Form B, if the [type] is 1, then I want the combo box to only display the choice for 1. If [type] = 2, then only display the "requirement" choices with a code of 2, and same for 3.

    I cannot figured out how to code the "onOpen", or "OnLoad" field in the combo box, or in the properites for Form B, to set the combo box query, based on the value in [Type} box. It keeps showing all requirement choices.



    Thank you.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    Sounds like you are trying to set up something that is referred to Cascading Dependent Combo Boxes. I use the AfterUpdate Event of the parent combo to assign a RowSource to the dependent combo(s).

  4. #4
    MSAccessOldTimer is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    May 2012
    Posts
    46
    pbaldy & ItsMe,Thanks. Unfortunately the [Type] field is a not a combo box field on Form B. It is used to display the selection from Form A, which is a combo box. It is a "locked" field, and the data is displayed in a regular field. I am familiar with the cascading combo box programming, but since the data displayed on the upper portion of Form B is a subset of data from the same table used by Form A, a combo box field will not work. I do not want the user to be able to change the [type] on Form B....that would create some bigger issues.

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    The same methods should work, but perhaps in the load event since the value can't change. Actually, using the method with a form criteria should work without code.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    MSAccessOldTimer is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    May 2012
    Posts
    46
    I will give that a try and let you know. Probably tomorrow before I get to that point now....off to meetings. Thanks so much.

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    No problem.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Filter combo box data based on a form control
    By onechriswhite in forum Forms
    Replies: 6
    Last Post: 08-29-2015, 09:21 PM
  2. Replies: 5
    Last Post: 12-11-2013, 08:15 AM
  3. Report based on Query but filtered by form
    By michel_annie22 in forum Reports
    Replies: 1
    Last Post: 10-23-2012, 10:40 PM
  4. Replies: 5
    Last Post: 01-02-2011, 10:09 AM
  5. Replies: 1
    Last Post: 10-19-2009, 02:37 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