Results 1 to 13 of 13
  1. #1
    Moghees is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Apr 2011
    Posts
    8

    Combo Box to populate selected information in a form (Web Database)

    Hi



    I am looking into a way to create a form with multiple combo boxes and depending on what is selected in the first combo box certains values will appear in the second combo box, for examaple if if have a list of employees and want to see which department they work for.

    So the first combo box would have department and I would choose HR and then in the second combo box i would get a list of all the personells working in the HR department

    I have started of by creating 2 tables. one with a list of departments and a second with personells.

    I am trying this in Access 2010 web database linked to sharepoint 2010


    thanks in advance for any help people provide

  2. #2
    10 Gauge's Avatar
    10 Gauge is offline Getting the hang of it...
    Windows XP Access 2007
    Join Date
    Feb 2011
    Location
    Fredericksburg, VA
    Posts
    202
    You want what is called a "Cascading Combo Box", do a quick google for that term and you will find a plethora of information on how to execute it. Alternatively you can do a forum search for the same term and come up with a lot of threads on how to execute this.

  3. #3
    Moghees is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Apr 2011
    Posts
    8
    thank you will look into it straight away

  4. #4
    Moghees is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Apr 2011
    Posts
    8
    Im following one of the tutorial provided

    " http://www.fontstuff.com/access/acctut10.htm#download"

    and managed to get the department list to work with the following



    SELECT DISTINCT tblPerson.Director FROM tblPerson ORDER BY tblPerson.Director;

    this brings the information up from the table,

    but i dont know how to input the following code for the after update in Access 2010



    Private Sub cboCountry_AfterUpdate()
    cboCity.RowSource = "Select tblAll.City " & _
    "FROM tblAll " & _
    "WHERE tblAll.Country = '" & cboCountry.Value & "' " & _
    "ORDER BY tblAll.City;"
    End Sub

  5. #5
    10 Gauge's Avatar
    10 Gauge is offline Getting the hang of it...
    Windows XP Access 2007
    Join Date
    Feb 2011
    Location
    Fredericksburg, VA
    Posts
    202
    Select your primary combo box, on the property sheet click on the "Event" tab. Then for "After Update" click the "..." at the end and if it asks you what builder you want click on Code Builder. This will take you to the VBA program and let you enter in your AfterUpdate event.

  6. #6
    Moghees is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Apr 2011
    Posts
    8
    sorry to be a pain ive tried and i get the Macro Tools Design view and it is automatically selected as Single Step and does not let me click on the "Convert Macros to visual Basics.

    I think it maybe cause its a web database

  7. #7
    10 Gauge's Avatar
    10 Gauge is offline Getting the hang of it...
    Windows XP Access 2007
    Join Date
    Feb 2011
    Location
    Fredericksburg, VA
    Posts
    202
    Ah, that could be. In which case it's far beyond my area of expertise (very narrow to begin with, haha). Maybe one of the MVP's will float through here and get ya taken care of. Good luck!

  8. #8
    Moghees is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Apr 2011
    Posts
    8
    I have now two tables tblDepartment with Depart as the primary key and another table Person with People as the primary key and Depart as a foreign key linked to Department.


    I have a subform with a 2 combo box Department and Person combo box.

    For the Department combo box the rowsource is: SELECT tblDepartment.Director FROM tblDepartment;
    and it AfterUpdate event is:
    requery Control Name Person


    For the Department combo box rowsource the following query
    Person from tblPeople
    Depart from tblDepartment and criteria
    [Forms]![formPeople].[Director]


    I am wanting the Person combo to only show values based on the selection made in the Department Box.

  9. #9
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    Have you seen the video tutorial at DataPig? It deals with 2 combo boxes.
    It is not in Acc2010.
    May be worth watching.
    http://www.datapigtechnologies.com/f...combobox2.html

  10. #10
    Moghees is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Apr 2011
    Posts
    8
    Ive seen a similar video and managed to get this work but when I move the form and make it a subform and web access it stops working and doesnt syncronise with Sharepoint ...


    Thanks for the video thou

  11. #11
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    I have no experience with sharepoint or 2010, but as per your post #6, the web database would seem to be the unknown issue. Cascading combo boxes have been tested time and again, so the web database is where I'd suggest looking.

  12. #12
    Moghees is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Apr 2011
    Posts
    8
    i can get the combo boxes to work but when i syncronise i get the following error if anyone can help



    Invalid reference 'forms.frmtable.cmbDirector' in expression.

  13. #13
    10 Gauge's Avatar
    10 Gauge is offline Getting the hang of it...
    Windows XP Access 2007
    Join Date
    Feb 2011
    Location
    Fredericksburg, VA
    Posts
    202
    Try replacing the "."'s with "!"'s?

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

Similar Threads

  1. Replies: 4
    Last Post: 01-24-2011, 07:11 PM
  2. Replies: 1
    Last Post: 01-10-2011, 12:25 AM
  3. Replies: 1
    Last Post: 11-23-2010, 01:30 PM
  4. Text Boxe Issue
    By wes028 in forum Access
    Replies: 2
    Last Post: 01-19-2010, 01:36 PM
  5. Populate Combo Box
    By wes28 in forum Programming
    Replies: 1
    Last Post: 03-04-2009, 06:45 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