Results 1 to 8 of 8
  1. #1
    ribena1980 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2015
    Posts
    7

    Combo Box Advice

    Hi Folks,



    Hoping someone can help me out with this. Its a very small datebase for my own records and I dont want to over complicate it. I am using Access 2010 64 Bit Version

    Basically I have a Locations Table as follows

    Country City
    UK London
    UK Manchester
    UK Birmingham
    UK Newcastle
    USA New York
    USA California
    USA Arizona
    Spain Madrid
    Germany Berlin
    Italy Rome
    France Paris
    Canada Toronto

    Each City is unique and the Primary Key, where as each Country can have more than one City.

    One the Transactions table I am looking to have the following set up.


    Transaction_ID
    Transaction_Date
    Transaction_Details
    Country
    City



    Transaction ID is the primary key, Transaction Date And Details are fine.

    When the user enters a Country, I want it to pick a value from the Locations Table Field via a Combo Box.

    Following on from that, when a Country is Selected, I want a Combo Box to select a City that is only valid for that country. So if the user selects Canada, I dont want any other cities, apart from Canadian ones appearing there.

    Any help greatly appreciated.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,527
    cboCountry has the query qsCountries
    cboCity has the query qsCity1Country , this query uses the paramater that looks at the cboCountry on the form...

    select City from table where [country] = forms!frmForm!cboCountry

    also in the cboCountry_AFTERUPDATE event put
    cboCity.requery

  3. #3
    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,728
    There are a number of free videos regarding Combo boxes on this site
    https://www.accessforums.net/tutoria...ers-52741.html
    These were prepared by forum member ItsMe. The instructions for using these videos are in the referenced (link) thread.

    You may also be interested in these 2 Cascading Combo videos from Datapig.
    http://www.datapigtechnologies.com/f...combobox1.html
    http://www.datapigtechnologies.com/f...combobox2.html

    Good luck.

  4. #4
    ribena1980 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2015
    Posts
    7
    Hi Folks,

    Should have said, I was hoping to do this using Tables as oppose to forms. I know this is widely frowned upon but it is a small database for personal use.

    Any advice?

    Thanks,
    Mark

  5. #5
    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,728
    I would still use a form.
    Biggest issue with any database is to get your tables and relationships designed to match your requirements.
    One of the best tutorials is this one from RogersAccessLibrary --but you have to work through it to appreciate the concepts. It does have a solution included.

    If you are looking for Access tutorials -- Steve Bishop has a great playlist here. Steve is a member of this forum.

    Good luck with your database.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,945
    Cannot have code behind tables (except for Data Macros). Cascading combo/list boxes must be on form.
    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
    ribena1980 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2015
    Posts
    7
    Hi Folks,

    Thanks for all your help. Ive Con(Form)ed and used a form as oppose to a table :-)

    Ive also used a 3rd field (Continent) and have a 3 tier cascading combo box, which thanks to the advice on here I have working :-)

    There is one little issue I was hoping someone could help me kick out.

    When I select the Continent, lets say Europe, Country Spain and City Madrid, If I go back and select the Continent as Asia, it updates the other 2 combo boxes with regional values, which is what I want but if I dont change the values that are already there I can enter something along the lines of Asia, Spain, Madrid even though it violates Referential Integrity.

    Is there an error I can put in to prevent the user doing this before it gets committed to the table?

    Thanks Again,
    Mark

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,945
    When value is selected in first 2 boxes, set the following box(es) to Null.
    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. structure advice?
    By akwormy in forum Forms
    Replies: 2
    Last Post: 06-11-2014, 06:43 AM
  2. New-and need help as well as advice
    By bjd1020 in forum Access
    Replies: 8
    Last Post: 11-16-2012, 02:25 PM
  3. Need some advice and help
    By winterh in forum Access
    Replies: 9
    Last Post: 04-18-2012, 06:41 AM
  4. Security Advice
    By jpkeller55 in forum Access
    Replies: 6
    Last Post: 02-18-2011, 08:22 AM
  5. Need advice on what I have so far
    By rumplestiltskin in forum Database Design
    Replies: 2
    Last Post: 05-25-2006, 12:48 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