Picking up wrong record (1 Viewer)

Abbosy

Registered User.
Local time
Today, 05:55
Joined
Dec 4, 2013
Messages
59
Hi there nice forum :cool:

The problem I'm facing is like this:

I have a table called "Cities" which has only two fields; City & Province.
I have connected it in a relationship with another table as "Include ALL records from 'Cities' and only those records from 'tblInstallations' where the joined fields are equal."
I have put an "AfterUpdate" event which works and everything
It is working fine and updates the province correctly.
The problem is that is putting another city from same province in the "City" field even though I picked up different name.
Have I explained it clearly? I hope so.

Thanks in advance for any help.
 

pr2-eugin

Super Moderator
Local time
Today, 13:55
Joined
Nov 30, 2011
Messages
8,494
Not clear enough ! show the Rowsource of the two combo boxes involved and any associated code with it.
 

Abbosy

Registered User.
Local time
Today, 05:55
Joined
Dec 4, 2013
Messages
59
Hi Eugine :)

Its actually one ComboBox "City" and the other one is a TextBox.
These fields are both from a table called "Cities".
I need to select a city from "City" ComboBox and for "Province" to show the matching Province name. Its just a basic one.
What is happening now is: When I select the city, say Chelsea for it to display "London" in the field "Province". I find the list of cities and that's all OK, but when I select the city, Chelsea it displays another name say "Harrow & Wealsden" in the "City" field even though its putting the right Province.

I have attached the relationship, city RowSource and province RowSource screen shots.

Many thanks for taking the time to help
 

Attachments

  • Installations_Cities_Relationship.jpg
    Installations_Cities_Relationship.jpg
    15.9 KB · Views: 85
  • City_Property_Sheet.jpg
    City_Property_Sheet.jpg
    43.1 KB · Views: 70
  • Province_Property_Sheet.jpg
    Province_Property_Sheet.jpg
    28.7 KB · Views: 70

CazB

Registered User.
Local time
Today, 13:55
Joined
Jul 17, 2013
Messages
309
Question: why are you storing both the City and Province in your Installations table?

You'd be better adding a unique ID to the Cities table, maybe calling it CityID, and then storing that in the Installations table - you can then lookup / display up the City and Province using the CityID field whenever you like, confident that you will have the right City AND Province :)
 

Abbosy

Registered User.
Local time
Today, 05:55
Joined
Dec 4, 2013
Messages
59
Hi Eugin

Yes, it did work. Many thanks to you
 

Abbosy

Registered User.
Local time
Today, 05:55
Joined
Dec 4, 2013
Messages
59
Hi CazB :eek:

Sorry, I put my reply to Eugin. Actually I need to thank you both for taking the time to help. :)

I do need both fields because we have installations and its then when we put name of the city in the Cities table. Then when need to service what we've installed, we'll need to know where exactly its installed.

I added a CityID as you suggested and this apparently fixed the problem, which is great.

Many thanks again and regards
 

Users who are viewing this thread

Top Bottom