Muli forms in Access, how do I know they update to each other?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have created several forms, I have created the relationships between them
(I think), how to I connect them so that they all update? Example, I enter
customer data on one table and business license on another. How do they
connect?
 
Sarah said:
I have created several forms, I have created the relationships
between them (I think), how to I connect them so that they all
update? Example, I enter customer data on one table and business
license on another. How do they connect?

They are connected by having the same data in the field or fields that you
used to create the relationship. If you are expecting the relationship to
automatcially do something to the data that is not how relationships work.
All they do is impose rules (if referential integrity is enforced). Those
rules can automatically propagate changes to the linking fields or
automatically cascade deletes if the relationship is confgured to do so, but
relationships never cause data to just show up in other tables.
 
I am having trouble with the lingo in Access. They show examples in the book
where you open in the 1st form (Customer Info) and at the bottom you can
select a button to another form (license information) and another buttom to
another form (activities). When I click through all forms and enter the
information I want to be able to run a report of who has or has not paid for
their 2005 license. Make sense? What are these steps called? Right now I
have the "CustomerNumberID" field on each form and they are the priomary key
for each, this is also what links them in "Relationships" Am I heading in
the right direction?
 
I am having trouble with the lingo in Access. They show examples in the book
where you open in the 1st form (Customer Info) and at the bottom you can
select a button to another form (license information) and another buttom to
another form (activities). When I click through all forms and enter the
information I want to be able to run a report of who has or has not paid for
their 2005 license. Make sense? What are these steps called? Right now I
have the "CustomerNumberID" field on each form and they are the priomary key
for each, this is also what links them in "Relationships" Am I heading in
the right direction?

I think your first misconception (and it's an easy one go fall into!)
is that data is stored in Forms, and that you can link the data in one
Form to another Form. Forms don't "update to each other" - different
Forms may be windows onto the same table, viewing it in a different
manner, but this is a different matter than "updating".

Data is stored in Tables and *ONLY* in Tables. A Form is just a tool,
a movable window which lets you edit the data in a Table (usually via
a Query). The examples in the book (which book, might I ask??) appear
to be starting at about step 6 of the database design process!

Rough outline:

Turn off the computer. Get a #2 pencil with a good eraser and a pad of
paper, and a cup of tea, coffee, or your preferred mild stimulant
beverage of choice.

- Identify the Entities, real-life things, persons or events, of
importance. In this case, I'd imagine Customers, Licenses, Activities,
probably Payments, maybe more.

- Identify each Entity's attributes: a Person has attributes such as
lastname, firstname, other identifying information. A Person may have
a single address (at least only one address that you care about, maybe
you don't need to know where their fishing cabin is), or might have
more than one; if one, then the person would have attributes Address1,
Address2, City, State, PostCode. Or these might be attributes of an
Address entity related to the Person entity.

- Identify how the Entities are related. A Customer will have zero,
one, or more(?) Licenses; each License will pertain to one and only
one Customer, for example.

- Given these, for each type of Entity you would create a Table. Each
Table should have ITS OWN Primary Key - it's *VERY* rare that two
tables would both have the same primary key! The Primary Key of the
Customer table might be your CustomerNumber (or CustomerID, it's
probably not a NumberID) - a field which uniquely and clearly
identifies each customer. The Primary Key of the Licenses table would
NOT be the CustomerNumber unless each customer has one, and *only*
one, license, ever over the course of your application's lifetime. It
might be the LicenseNo (I don't know whether these are drivers'
licences, auto license plates, dog licenses or what <g>). The Licenses
table *would* contain the CustomerNumber, but this would be a separate
field - called a "foreign key" - used to link to the Customers table.

Each attribute would correspond to one field in the table. If you find
yourself putting in repeated values - such as License2003,
License2004, License2005 or Payment1, Payment2, Payment3 - STOP;
you've discovered another entity in a one-to-many relationship with
this table.

- ONLY NOW would you start thinking about how to design Forms to enter
this data. Access' forms are quite versatile; you will probably make a
lot more use of a Form with Subforms, than you will need buttons
opening other forms (though such buttons are handy and often used,
they require VBA code and aren't necessary for most purposes).


John W. Vinson[MVP]
 
The book I am using is Mastering Microsoft Access 3rd Edition. I have done
the manual work on the database before I started, but have now gone back to
identify the one to many relationships. How do I tell access these are one
to many relationships? Thanks for the help.
 
The book I am using is Mastering Microsoft Access 3rd Edition. I have done
the manual work on the database before I started, but have now gone back to
identify the one to many relationships. How do I tell access these are one
to many relationships? Thanks for the help.

Open the database window, but don't open any tables or forms. Instead,
click the relationships icon - it looks like three little boxes
connected by lines.

Add your tables, and drag the Primary Key field from each "one" side
of a relationship to the matching field in the "many" side table.
Check the "Enforce Relational Integrity" checkbox.

If your tables don't have primary keys... well, then they're not
tables. Every table must have a primary key!

If you already have data in your tables it might not let you define
relational integrity (if, for instance, there are "many" side records
which don't have a valid parent record). You'll need to fix these
errors before you can define the relationship.

John W. Vinson[MVP]
 
Back
Top