473,407 Members | 2,312 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,407 software developers and data experts.

I have a question concerning a one-to-many relationship in Access 2007

I have a form in Access 2007 with a field that the user will enter a ZIP Code. I have a table/query that contains every ZIP Code I need (well over 80,000). The data contains not only the ZIP Codes for each location (with city, county, state) but also for surrounding communities that use the same ZIP Code i.e. the ZIP Code for the main city is 12345 and the surrounding communities do not have their own ZIP Codes but share the one with the main city.

The problem is that the main tables contains addresses that might reference one of these surrounding communities and we would want to maintain that address as entered. If I had a one-to-one relationship it would be easy... but since a single ZIP Code could refer to multiple cities/towns I don't know how to do it. I want the user performing the data entry to be able to enter a ZIP Code. The ZIP Code is then looked up in the ZIP Code table and if it is a one-to-one correspondence than I want it to populate the fields for the city, county, and state (and display them on the form).

If there is a one-to-many correspondence, then I want the user to be able to select from a list of the possible cities and after the selection, the correct city/county/state fields are populated. Is this possible?
Oct 8 '10 #1
4 1350
dsatino
393 256MB
Yes, it's possible. The real question is how to go about doing it.

I'm sure you'll get several different answers on this so you may want to wait a few days and examine all of them before you proceed, but here is what I would do.

When a Zip is entered, count the number of cities associated with it. If you have only one, then populate the city for the record you are creating. If you have more than one, then populate a combobox with all the related cities.
Oct 8 '10 #2
NeoPa
32,556 Expert Mod 16PB
Nice idea DSatino.

Always populate a ComboBox with the results. The relevant (bound) fields would be updated in code if either :
  1. The record is unique when the ComboBox is populated.
  2. The ComboBox is updated.
Oct 8 '10 #3
That was my original approach. But my problem is that once I have the combo box list down and the user selects the city that want, the combo box only lets me return a single value (i.e. the city name). How can I return the other fields in the ZIP Code record like the county and state? I need to populate their corresponding fields in the main table/query and display them on the main form (the invoking form) as well.
Oct 9 '10 #4
NeoPa
32,556 Expert Mod 16PB
Use a Multi-Column ComboBox. The code to populate your various TextBox controls would use the ComboBox's .Columns property to take each value to it's proper place.
Oct 9 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: George | last post by:
I wrote a function that basically executes a dynamic query and returns True if there is at least one record and false in not. CREATE OR REPLACE FUNCTION RecordHasChild (table1, CHARACTER,...
0
by: Jass | last post by:
Hi everybody! I guess the subject really states my question. I have a relatively simple query where I'm using an order by clause. The tables participating in the query have no more than ~300...
1
by: rashika | last post by:
Hi : Can i call 2 procs within one task? I have sp_proc1 ? (and have declared one global variable as input parameter) now i have another sp_proc2 which uses same input parameter but if i...
7
by: tony | last post by:
Hi Any one know that can VS.net 2005 with vs.net 2003 worked together in one manchine? if it can working together, how can I set up it? Thanks Tony
25
by: Method Man | last post by:
Q: Write a C/C++ program that takes an unsigned integer and adds 1 to it without using the plus or minus signs. Don't worry about overflow issues. It is cheating to use assembly commands, or to...
5
by: Dennis M. Marks | last post by:
After reading section 15.9.1.1 the ECMAScript Language Specifications I see that the date range for the Date function is +/- 100,000,000 days from 01 Jan 1970. This is called an extrapolated...
3
by: Larry R Harrison Jr | last post by:
I designed this webpage: http://www.dbases.net/photography_pages/new_style_frames_index.html It has horizontal hover/pop-down menus; it works fine on the given machine run off the hard drive,...
9
by: =?ISO-8859-15?Q?Joachim_B=F6rger?= | last post by:
Good evening! I'm using variables to count from 0 to 4 in a recursion, and I just realized that I could save a lot of memory (and computational time?) by using a BYTE instead of an int. But,...
2
by: Richsaum | last post by:
Hello all, I am trying to put one form across 2 table cells, is such a thing possible? It's a small questionnaire that will go across 2 table cells, so that when they are done, one click would...
2
amarniit
by: amarniit | last post by:
Consider the following relations concerning a driving school. The primary key of each relation in bold. Student (st_id, class#, th_mark, dr_mark) Student_Driving_Teacher...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.