Re: List Box Madness
- From: "Larry Daugherty" <Larry.NoSpam.Daugherty@xxxxxxxxxxx>
- Date: Tue, 16 May 2006 15:33:26 -0700
It sounds like someone once had a better schema going than the current
one. I recommend going back to the earlier one. My guess would be
that the later design happened because someone didn't understand how
to dynamically change the company criteria in a query. That's how
they came up with the idea of multiple company/location tables.
There is an old adage in the design of database systems that goes
something like this: "Get the tables done correctly and everything
else will be simple".
The first step in the actual design process is to resolve the entities
in play in your application and assure that each entity has a table.
All entities of a given type belong in that one table (you should
never have multiple tables referring to the same kind of thing)..
The primary key of the Company table should appear in the
CompanyLocation table as a Foreign Key. Then, in the Relationships
window, draw a line from tblcompany.primaryKey to
tblCompanyLocation.foreignKey by what ever names you have given them.
Double click the link and establish the relationship as one-to-many
between Company and CompanyLocation. Turn Referential Integrity on
and enable cascading deletes. Once you have done that you'll only be
able to create a CompanyLocation record when you have a corresponding
Company record; you won't be able to create orphan locations. Also,
if you delete a company you will also delete all of its locations.
Form design:
I recommend a Find Company: combobox in the header of your form. Tell
the wizard you want to go to a particular record.
To display your CompanyLocations I'd use a listbox whose recordsourse
is a query on tblCompanyLocation. Using the QBE grid on the query for
the listbox: in the criteria line for the ForeignKey refer to the
form's value of the company's primary key.
HTH
--
-Larry-
--
"Jay" <zeugma@xxxxxxxxxxxxxx> wrote in message
news:C08FED09.A0E7%zeugma@xxxxxxxxxxxxxxxxx
The telephone girls at work use a call log database. The main formwhere
call details are input *should* be pretty simple. The first item isa
pulldown list of customers. The second is a list box for customerlocation,
so that if customer x has 3 offices, the correct location can bechosen.
However, this is where it gets a bit mad. Each company has its ownlocation
table (with only up to about 6 or 7 records in at the most). Andthe
location list box is actually a list box for each table on top ofeach
other! (so that what looks like one in design view is actually 20all in the
same place), I've looked at the VBA and there appears to be codewith code
making a particular list box visible (& the others not visible) ifthat
company is selected in the first 'company' field !?defunct
I can see he has attempted to do it another way as there is a
company~location table.originally
So my question is, what's the simplest way of doing what he was
trying to do? I presume one table with companies & locations linkedto a
queried control of some sort.
Any help appreciated.
-Jay-
.
- Follow-Ups:
- Re: List Box Madness
- From: Jay
- Re: List Box Madness
- References:
- List Box Madness
- From: Jay
- List Box Madness
- Prev by Date: Re: List Box Madness
- Next by Date: Re: Use info from one table to search in another
- Previous by thread: Re: List Box Madness
- Next by thread: Re: List Box Madness
- Index(es):
Relevant Pages
|