Re: Combo Box Design and/or Coding
- From: "tina" <nospam@xxxxxxxxxxx>
- Date: Fri, 25 Nov 2005 21:11:51 GMT
you're describing a many-to-many relationship between tblHotels and
tblLocations. that is resolved with a "linking" table, as
tblHotelLocations
HotelID (foreign key from tblHotels)
LocationID (foreign key from tblLocations)
you may use the two fields as a combination primary key, which will ensure
that each combination is unique. if you prefer to work with single-field
primary keys, you can add another field to serve as a surrogate primary key,
such as HLID (data type Autonumber). in that case, you can still create a
unique (though not primary) index of the two foreign key fields, to ensure
that each combination is unique.
note: strongly recommend that you do NOT use Lookup fields in
tblHotelLocations (or in any other table in your database, for that matter).
the relationships are
tblHotels (parent) 1:n tblHotelLocations (child)
tblLocations (parent) 1:n tblHotelLocations (child)
in a form, you can use combo boxes to allow selections of specific hotels
and locations from those parent tables. (suggest you look up the following
combo box control Properties in Access Help, to learn how they work:
RowSourceType, RowSource, ColumnCount, ColumnWidths, BoundColumn, ListWidth,
LimitToList, and NotInList.) there are several ways to add records to the
parent tables while in the form, utilizing the NotInList event. see
http://www.mvps.org/access/forms/frm0015.htm for one solution; you can find
others by doing a search on these newsgroups (this is a common question).
hth
"bw" <iamnu@xxxxxxxxxxxx> wrote in message
news:11oeugjcg4jnl21@xxxxxxxxxxxxxxxxxxxxx
> I don't know if this is a design problem, or coding. In any case, I don't
> know how to do what I want.
>
> I want to have a table of Hotels.
> I want to have a table of Locations.
>
> Hotels may have many Locations.
> Locations may have many Hotels.
> A Hotel/Location combination must be unique.
>
> So I would like to know how to set up the Table(s) to accomplish this, and
> maybe an explanation as to what the relationships are here.
>
> From a practical stand point, I want to be able to allow for selection of
a
> Hotel/Location combination, on a Form, AND to be able to update these
tables
> from the Form, if the Hotel/Location combination does not currently exist.
>
> I'm appreciative of any help received.
>
> Thanks,
> Bernie
>
>
.
- Follow-Ups:
- Re: Combo Box Design and/or Coding
- From: bw
- Re: Combo Box Design and/or Coding
- References:
- Combo Box Design and/or Coding
- From: bw
- Combo Box Design and/or Coding
- Prev by Date: Combo Box Design and/or Coding
- Next by Date: Re: Combo Box Design and/or Coding
- Previous by thread: Combo Box Design and/or Coding
- Next by thread: Re: Combo Box Design and/or Coding
- Index(es):
Relevant Pages
|