Results 1 to 3 of 3
  1. #1
    BlackBooks is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2017
    Posts
    2

    Entry choices dependant on another field entry

    How do I restrict the options in a lookup field to only those dependant on another fields data.



    For example, say I had a field for "car make" and another for "car model" . If someone enters "Honda" For the "car make", I want to only be able to choose from a list of Honda models for the "car model" field. Similarly, if they choose "Ford" for car make, I want them to only be able to choose from a list of Ford models. How would I set this up?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,522
    there's a little code to this.
    the combo box cboModel query, gets its values from cboMake.
    qsModels: select [model] from tCars where [make]=forms!myForm!cboMake

    then when the user picks cboModel, you must refresh the cbo box in the afterupdate event:
    Code:
    sub cboMake_Afterupdate()
      cboModel.requery
    end sub

    set the combo box to LIMIT TO LIST = TRUE

  3. #3
    Missinglinq's Avatar
    Missinglinq is online now VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    And FYI, for future reference, the concept is called Cascading Comboboxes...and the same concept/code can be used for Listboxes if the Multi-Select Property is set to None.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

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

Similar Threads

  1. Replies: 4
    Last Post: 12-21-2015, 10:57 PM
  2. Replies: 5
    Last Post: 03-09-2014, 07:16 PM
  3. Replies: 2
    Last Post: 05-20-2013, 05:23 PM
  4. Disable a field entry dependent on another field entry
    By asinha9 in forum Database Design
    Replies: 1
    Last Post: 03-21-2013, 01:16 AM
  5. Replies: 6
    Last Post: 09-27-2012, 08:27 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