473,396 Members | 1,608 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

combo box advice

I need to have a combo box which will display the countries
from(Country table) and then user would select the country, which would
display the cites for that particular country, in another combo box.

I have set the relation from the country table to the city table. The
problem is when I select a country from the country combo box the
relevant cities are not displayed on the city combo box. I assume since
the relationship is set as i select a country from the country combo
box the information in the city combo box would change......like the
way it happens in form and subforms....... that's my understanding i
might be wrong. Anyway i tried this it does not work.

Then i tried to change the control source for the city combo, where it
is a query which would pull up the cities for the selected country in
the country combo box.... this also doesn't seems to work

Actually what i need to do is, the user to select a origin country/city
and a destination country/city. For this i have created a from-country
and from-city tables and to-country and to-city tables which have
identical information. (Which i feel is not correct)... require advice
on this...

The selected from-destination and to-destination would be used as a
parameter for a query.

Any help Pls, as i am bit new to Access.

Nov 13 '05 #1
5 1904
"praz" <ge*****@gmail.com> wrote in
news:11**********************@o13g2000cwo.googlegr oups.com:
I need to have a combo box which will display the countries
from(Country table) and then user would select the country,
which would display the cites for that particular country, in
another combo box.

I have set the relation from the country table to the city
table. The problem is when I select a country from the country
combo box the relevant cities are not displayed on the city
combo box. I assume since the relationship is set as i select
a country from the country combo box the information in the
city combo box would change......like the way it happens in
form and subforms....... that's my understanding i might be
wrong. Anyway i tried this it does not work.

Then i tried to change the control source for the city combo,
where it is a query which would pull up the cities for the
selected country in the country combo box.... this also
doesn't seems to work

Actually what i need to do is, the user to select a origin
country/city and a destination country/city. For this i have
created a from-country and from-city tables and to-country and
to-city tables which have identical information. (Which i feel
is not correct)... require advice on this...

The selected from-destination and to-destination would be used
as a parameter for a query.

Any help Pls, as i am bit new to Access.

You only need one country-city table and one country table, as
you suspect. The rowsource for both country comboboxes refers to
the same table. For the rowsource of each city, use a slightly
different query, just make the where clause of the query point to
the relevant country combobox.

In each of your country comboboxes,you will want the bound column
of the combobox to be the countryID field, and the second field
the country name, and the displaywidth of the countryid 0.
Now assuming your from country box is named cbo_Country_from,
create the cbo_city_from box. Its rowsource should be

SELECT cityid, city from cities where countryID = forms!formname!
cbo_country_from.value

In the afterupdate event of cbo_country_from, add the statement

me.cbo_city_from requery.

This is required because as you have noted, the combobox does not
force relationships. There are a lot of combobox uses that don't
want referential integrity, so you have to program it where you
do want it.

do the same thing to your cbo_city_to and cbo_country_to pairs.
--
Bob Quintal

PA is y I've altered my email address.
Nov 13 '05 #2
Thanks a million Bob.This works!

Now I can proceed further........
Praz

Nov 13 '05 #3
As mentioned earlier.......your solution worked for the earlier problem
i had. Now I have problem in fetching data after the user selects the
from_country/city and to_country/City....what needs to happen is a
results should be displayed from the From_country_requirement table and
To_country_Requirement table
Fields in the From_country_requirement table is as follows
Country_code
City_Code
From_Requirement_details

and the fields in the To_country_requirement table is
Country_code
City_Code
To_Requirement_details

I have a button, when clicked after the user selects the country and
cites, should display the relavent from_country requiremnet details and
to_country requirement details

Also i not able to set up relations between the country, city and
From_country_requirement table/To_country_requirement table and design
the screen to input the requirements details for a particular country
and city....... I have just populated the requirement tables manually
and trying out the query.......

Any help appreciated.....

Nov 13 '05 #4
"praz" <ge*****@gmail.com> wrote in
news:11**********************@f14g2000cwb.googlegr oups.com:
As mentioned earlier.......your solution worked for the
earlier problem i had. Now I have problem in fetching data
after the user selects the from_country/city and
to_country/City....what needs to happen is a results should be
displayed from the From_country_requirement table and
To_country_Requirement table Fields in the
From_country_requirement table is as follows Country_code
City_Code
From_Requirement_details

How do you intend to display the data(in a subform, a popup form,
a control on the existing form)?

Let's say you intend to show a new form. The button should
execute the following statements:

Docmd.openform "frm_From_couhntry_requirement",,"Country_Code =
" & me.cbo_country_from & " AND City_Code = " & me.cbo_City_From

And a similar one for the second form.

If you instead want to populate a textbox on the already open
form, Use
me.txt_FromCountryRequirements = DLookup
("From_Requirement_Details", From_country_requirement",
"Country_Code = " & me.cbo_country_from & " AND City_Code = " &
me.cbo_City_From)

It's really difficult to understand exactly what you want.
and the fields in the To_country_requirement table is
Country_code
City_Code
To_Requirement_details

I have a button, when clicked after the user selects the
country and cites, should display the relavent from_country
requiremnet details and to_country requirement details

Also i not able to set up relations between the country, city
and From_country_requirement table/To_country_requirement
table and design the screen to input the requirements details
for a particular country and city....... I have just populated
the requirement tables manually and trying out the
query.......
I don't know why you have trouble with this. Tell us error
messages, misbehaviour

Any help appreciated.....


--
Bob Quintal

PA is y I've altered my email address.
Nov 13 '05 #5
Hi Bob,

I am trying to display the data in a new form and have put these
statements (tried both them) on the button's on click property....

DoCmd.OpenForm "from_details subform1", , , "[Country_Code] = " &
Forms![From_CC_To_CC]!Combo0.Value & " AND [City_Code]= " &
Forms![From_CC_To_CC]!Combo4.Value
'" & me.cbo_country_from & " AND City_Code = " & me.cbo_City_From
DoCmd.OpenForm "from_details subform1", , , "[Country_Code] = " &
Me.Combo0 & " AND [City_Code]= " & Me.Combo4

When both these statements are executed ....it gives a Enter parameter
value box with my correct choices just above the text box within the
Enter parameter value box....... and then when i input my Country_code
and then City_code it open the new form with the correct data......

How can I avoid the Enter parameter value box?

Also when i don't select any country and city........and then click on
the button......it gives me an Run time error 3075

Syntax Error (missing operator) in query expression '[country_code] =
AND [City_code]='

Pls advice...... Thanks.

Nov 13 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Heather | last post by:
Hi I am desparately looking for advice in relation to storing the results after selecting items from two combo boxes on a Referral form. The first combo box 'ctl Type' displays a full list of...
2
by: Ray Bell | last post by:
There are 2 tables, a table called parent and a table called child. The parent table has 2 fields, an ID (AUTO Number: PK) and Name (Parent Name) The Child Table has 3 fields, an ID (AUTO...
5
by: Ant | last post by:
Hi, (Winform VS2003) I have a combo box bound to a typed data set. When the form loads, the combo box is popluated using a method containing the simple code below: ------------------------...
9
by: Edwinah63 | last post by:
Hi everyone, Please let there be someone out there who can help. I have two BOUND combo boxes on a continuous form, the second being dependent on the first. I have no problem getting the...
0
by: Tom | last post by:
I have some very strange issues with combo boxes on a tab control. Here's the scenario: I have a Windows Forms form that has a tab control on it, with two (2) tabs. Tab 2 happens to have a number...
1
by: zack | last post by:
I am really struggling to get to grips with this issue, would grateful for any advice. I have a form 'Applicant_Person' with various student contact data. There is a combo box to 2 options of...
2
by: sara | last post by:
I think I don't understand combo boxes and forms - and all that I'm reading is just confusing me more. I am doing a "favor" for a non-profit organization. They take a phone call and need to...
2
by: biganthony via AccessMonster.com | last post by:
Hi, I decided to install Office 2003 Service Pack 3 on my home computer to test (in full knowledge that there may be some issues with it). After installation, I have noticed that with a small...
1
by: gdixon | last post by:
Greetings To All! I am using a Access 2003 and my programing skills are of the cut and paste variety. This means begining programming skills and on a good day perhaps middle of the road...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.