Results 1 to 12 of 12
  1. #1
    wer4him is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jul 2013
    Posts
    2

    How to base the contents of a field on another field(combo box)

    I have control1(field1) on a form that I would like to auto-populate based on the choice made in a combo box control2(control source = column1 of table/query) on that same form.

    I would like the control source for control1 to remain from the table that the form is based on (field1), but the contents populated from the same table/query that the combo box control2 is choosing from, only from a different column.

    I have been successful with creating an unbound control and displaying the contents of the additional column, but I would like to store that data in the form's table.

    I know it would be easier to store only the contents of Control2 in the form table and use a query to bring the data from both tables but this is a very large database and field1 is already populated and I have lots of reports and other queries and forms based on it. So rather then revamping the entire database structure I would like to autopopulate field1 of the form table.



    Any help is appreciated

  2. #2
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529

  3. #3
    changedsoul is offline Novice
    Windows 8 Access 2007
    Join Date
    Jun 2013
    Posts
    13
    This is nice to know. How does it work for a combo box though. Say you wanted to use combo boxes to filter multiple items. for example, One combo box you can select "Male" or "Female". This would then populate another combo box with a list of bike types that only belong to what is selected in the first combo box. Then maybe the third combo box would fill with a list of rims that are available for the Bike type selected in the second combo box...and so on.


    Is this easy to do? and how can it be done?

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,958
    That is dependent (cascading) comboboxes. Review: http://datapigtechnologies.com/flash...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.

  5. #5
    changedsoul is offline Novice
    Windows 8 Access 2007
    Join Date
    Jun 2013
    Posts
    13
    Hello, thank you for that link to the video. This is exactly what I wish to accomplish. I have tried to duplicate it but cant seem to get it to work at all. I have attached a small sample database, can you please have a look and see what it is I am doing wrong?
    Attached Files Attached Files

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    See if this one gets you a little further along.
    Attached Files Attached Files

  7. #7
    changedsoul is offline Novice
    Windows 8 Access 2007
    Join Date
    Jun 2013
    Posts
    13
    Thanks. This helped me allot. I thought I had tried what you did. In fact when I tried to get the one I uploaded to match, I had problems. It turns out, Access seems to be very picky when making the query settings. I had to do it a few times before it seemed to stick. First time I tried, I made the settings but the combo boxes still didnt work. I went back into the query settings and they were back to the way they were before. It would have been nice to get a message saying something was wrong.

    It took me a few times, but now I am in the habit of going back and checking my settings to make sure they stick. So thank you for giving me a sample that works so i was able to find my problem.

    Also, I noticed you had another key word "DISTINCT" to limit duplicate entries. Is this knowledge you have gained from experience, or is there a gui approach to obtain that same query?

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,958
    What is 'qui approach'?

    UniqueValues (i.e. DISTINCT) is a property available in the query designer on the Property Sheet.

    Or type the SQL statement in query SQL View or directly in combobox RowSource property (the query designer can be invoked from the RowSource).
    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
    changedsoul is offline Novice
    Windows 8 Access 2007
    Join Date
    Jun 2013
    Posts
    13
    Thank you. I am still learning where things are in access. I didn't see it in the properties because I was un aware I had to click out side the query builder where the combo boxes are.
    Thanks again.

  10. #10
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Are we ready to mark this thread as Solved and start a new thread with another issue?

  11. #11
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,958
    Don't know what you mean by "had to click out side the query builder where the combo boxes are" - doesn't make sense to me. The Property Sheet shows for query in design view.
    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.

  12. #12
    wer4him is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jul 2013
    Posts
    2
    Quote Originally Posted by alansidman View Post
    Thank you this is what I wanted to do. I appreciate all the help. You can consider this resolved.

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

Similar Threads

  1. Replies: 3
    Last Post: 05-23-2011, 07:29 AM
  2. Replies: 0
    Last Post: 03-29-2011, 04:11 PM
  3. Select contents of a field on click?
    By anoob in forum Access
    Replies: 7
    Last Post: 03-01-2011, 07:59 AM
  4. Copy contents of one field to another
    By 10 Gauge in forum Forms
    Replies: 4
    Last Post: 02-11-2011, 09:51 AM
  5. Remove contents from each field
    By nancyszn in forum Access
    Replies: 7
    Last Post: 08-06-2009, 03:41 PM

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