Wrox Programmer Forums
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old December 16th, 2011, 06:06 PM
Authorized User
Join Date: Apr 2006
Posts: 46
Thanks: 0
Thanked 1 Time in 1 Post
Default unique values

Hi I have a problem and i need some help,

i have two entities 1 to many

Countries and cities.
so 1 country has many cities

i ve created a form with two listboxes

the fisrt listbox has all the countries and the second the cities

Now what i want is when i select a country from first listbox, the second listbox to show me only the cities of this country!!!



thanx a lot!!!!:)
Old December 19th, 2011, 09:55 AM
JP JP is offline
Authorized User
Join Date: Apr 2008
Posts: 57
Thanks: 1
Thanked 3 Times in 3 Posts

The easy way would be a table with two columns: City and Country. Let's call the table CitiesInCountries.

In the City field, list all of the cities, and in the Country field what country the city belongs to.

Then in the first listbox's Change Event you need a query like this (to populate the second listbox):

"SELECT Country FROM CitiesInCountries WHERE City = '" & ListBox1.Value & "'"
JP SoftTech

Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting unique values from substring rabs XSLT 6 March 13th, 2009 03:10 PM
Getting unique values from substring rabs XSLT 16 March 5th, 2009 01:39 PM
How to Generate Unique values for IDs mphare XSLT 7 November 6th, 2008 12:20 PM
including unique values from a range into a combo Kaustav Excel VBA 0 November 6th, 2006 09:17 AM
Unique values from a dataset gbuller Pro VB.NET 2002/2003 3 September 27th, 2004 12:17 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.