Results 1 to 12 of 12
  1. #1
    brobertson89 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Nov 2014
    Posts
    19

    Show only a specified list in a combo box depending on requirements

    Hi all,

    I have a probably simple problem that I am having a hard time trying to figure out how to do (I am also relatively new to Access, so that is not exactly helping).

    I have a list of companies that my business works for. Each of these companies requires a list of training courses to be completed prior to working for them. Finally I have a list of personnel who have undertaken these courses.

    What I want to be able to do is (on a form) select the company, from a combo box, that we are doing a job for and then in a second combo box have it only showing the employees who have undertaken the correct courses so that I can only select them.

    Any help would be greatly appreciated.



    Cheers,

    Brandon

  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,630
    These are dependent/cascading comboboxes. Review: http://www.datapigtechnologies.com/f...combobox2.html
    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
    brobertson89 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Nov 2014
    Posts
    19
    Okay so I understand that a dependent/cascading combobox might be the way to go but I am kind of confused about how I would apply my tables to those given in the example.

    I have three tables:

    Table 1 has the following fields:
    Customers - this is just a list of individual company names

    Table 2 has the following fields:
    ID - autonumber (this field is required because the other fields are not unique identifiers)
    Customers
    Courses - multiple courses can be selected for the same customer

    Table 3 has the following fields:
    ID - autonumber (this field is required because the other fields are not unique identifiers)
    Courses - these are the courses that each person has completed
    Personnel names

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,630
    Do you want to show only the personnel who have completed ALL courses for a particular company?
    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
    brobertson89 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Nov 2014
    Posts
    19
    Sorry about the delay but yes that is correct.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,630
    That does get tricky. Would help to work with data. If you want to provide db, follow instructions at bottom of my post.
    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.

  7. #7
    brobertson89 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Nov 2014
    Posts
    19
    Database2.zip

    Okay I have attached a simplified version of the database, there is nothing on the form at the moment so feel free to do whatever you need to.

    Thank you for your time, I really appreciate it!

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,630
    There is added complication because Course_personnel saves the course name but Customers_course saves a number ID. Really should be the same data type in both tables. Cannot join these tables on the two course fields. However, the lookup for Course field is pulling the ID from Course_personnel. That makes no sense at all. Should have Courses table that will be the source for any lookup to select a course. Each course would be a unique record in this table.
    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.

  9. #9
    brobertson89 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Nov 2014
    Posts
    19
    Okay I have added a table with the course names and I have redone the lookups as well as changing some naming to make it a little easier.Database2.zip

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,630
    Halfway there.

    Customers_requirements has a Course field set as text but it is number data. This has no relationship to Courses because there is no number IDs in Courses.

    Before proceeding you need a better understanding of relational database principles and what primary and foreign keys are.

    Here is a little info on primary keys and autonumbers.......

    Microsoft Access Tables: Primary Key Tips and Techniques
    http://www.fmsinc.com/free/newtips/primarykey.asp

    Autonumbers--What they are NOT and What They Are
    http://www.utteraccess.com/wiki/index.php/Autonumbers

    Use Autonumbers properly
    http://access.mvps.org/access/general/gen0025.htm

    A good tutorial site http://www.rogersaccesslibrary.com/
    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.

  11. #11
    brobertson89 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Nov 2014
    Posts
    19
    Database2.zip

    Okay I have had a good read and I have made some changes. Whenever I try and use the look up wizard to determine what values a field can have, it automatically matches it to the ID field not the course name or customer name fields. I manually created the relationship to overcome this and it seems to have worked. As for the number data in a text field that was because I had an ID field however when I deleted this it kept the numbers from that field.

  12. #12
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,630
    1. The lookup wizard is doing what it should (although I never use it or any of the design wizards). The ID should be the value saved, not the text descriptors for technician, company, course. The links in Relationship builder should be on ID primary key and related number foreign key fields.

    2. names make very poor keys, Technician Name should not be PK, ID should be

    3. name parts should be in separate fields - LastName, FirstName, Middle

    4. advise not to build lookups with alias in table http://access.mvps.org/access/lookupfields.htm

    5. advise no spaces or special characters/punctuation (underscore is exception) in naming convention

    As for your original question - see attached.
    Attached Files Attached Files
    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. Replies: 3
    Last Post: 07-20-2014, 08:56 PM
  2. Replies: 5
    Last Post: 08-08-2012, 01:30 PM
  3. Replies: 9
    Last Post: 02-02-2012, 04:59 AM
  4. show subform depending on combobox
    By d_Rana_b in forum Programming
    Replies: 2
    Last Post: 03-15-2011, 05:09 AM
  5. Replies: 2
    Last Post: 03-04-2011, 10:12 AM

Tags for this Thread

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