Results 1 to 12 of 12
  1. #1
    lios1984 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2012
    Posts
    29

    Help with form - list of choices

    What I want to do is to create a form where at the first field (Country I choose a country from the list and then at the second field City I choose a city that depends on the chosen Country. For example, if I choose Italy, then at the field City my list will have only Rome or Venice to choose (as I put it in the test file).

    Reading several posts, I found that this can be done by modifying the attributes of the list boxes but there are errors that I cannot surpass.

    I attach a test file of what I am trying to do. Could anyone please help me find the error or give me another solution to the problem?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,624
    This is cascading (dependent) comboboxes. Review tutorials at http://datapigtechnologies.com/AccessMain.htm especially the 3 on comboboxes in the Access Forms: Control Basics section.
    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
    lios1984 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2012
    Posts
    29
    Thank you very much for the videos. They have been really helpful. But I still have a problem with the Requery part. I follow the instructions as said on the video but Requery doesn't work. Is there any other way??

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,624
    What do you mean by doesn't work - error message, wrong results, nothing? If properly set up, the technique does work. No, I don't know any other way to produce this behavior.

    If you want to provide project with your effort, I will look it.
    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
    lios1984 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2012
    Posts
    29
    OK give me 2 minutes to attach a file

  6. #6
    lios1984 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2012
    Posts
    29
    Here it is. There is no error message, it just doesn't refresh the list of Cities when I choose another country.

    For example, I choose England and english cities come below. When I choose France, english cities still come below.

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,624
    Don't know what to say. Your form is working perfectly for me. Except the country and city comboboxes are not bound so data is not saving to 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.

  8. #8
    lios1984 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2012
    Posts
    29
    What do you mean "not bound"?

  9. #9
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,624
    They don't have ControlSource property set to field. The Description combobox is bound.
    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.

  10. #10
    lios1984 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2012
    Posts
    29
    I see. I have to set ControlSource to the matching field, right? Did that but still nothing.

    This is very important for me. It's the last important thing to do before my project is concluded and I start entering my data.

    So if you have any advice, any at all, please help me.

  11. #11
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,624
    If I can't replicate the issue with your project I can't say why it is not acting right for you.

    I select a country and the cities list is correct for that country. I select a different country and the city combobox requeries and list is correct for that country. However, the value in the city combobox, if there was one, is not changed. It would be a good idea to null this value when the country is changed: Me.cmbcities = Null

    I did find an error in the Lookup set for the Country field in the Data table that seemed to interfere after I added the above code. I never set Lookups in tables. Fix that one or remove them and see if the form behavior is better.
    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
    lios1984 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2012
    Posts
    29
    It seems to work now!!
    Thank you for everything.

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

Similar Threads

  1. List of Choices
    By lios1984 in forum Access
    Replies: 4
    Last Post: 01-30-2012, 02:14 PM
  2. Replies: 9
    Last Post: 12-07-2011, 04:30 PM
  3. Replies: 3
    Last Post: 08-19-2011, 09:25 AM
  4. Query to Limit Combo Box Choices
    By jimrockford in forum Queries
    Replies: 2
    Last Post: 04-23-2011, 10:24 PM
  5. Multiple Choices for Parameters with VBA and Queries
    By weasel7711 in forum Programming
    Replies: 3
    Last Post: 02-02-2011, 09:19 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