Using a form for a different table

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

Guest

I created a Form for a Table. Now I want to divide the table into smaller
subsets of the whole (new tables containing a smaller set of records from the
main table) but I want to use that same Form for all of the new tables. I'd
prefer not to have to go through all of the work to create new Forms for all
of the new tables (there will be approximately 12 new tables that need to use
the same Form). I can't figure out how to direct multiple tables to use the
same form or copy the form and reassociate it with a different table.

Any help would be appreciated.
 
Hi, Messy Guy.

Don't do it.

Dividing a recordset into multiple tables with identical structures is
unnecessarily complicated and makes your application much more difficult to
maintain. Instead, add a field that will allow you to differentiate the
recordsets of interest.

For example, instead of tables like Customers, Representatives, Suppliers,
Consultants, Government Agencies, add an OrgType field to an Organizations
table, and use a combo box on your form to select the type. The combo box
will get its rows from an OrgType table.

OrgID AutoNumber (Primary Key)
OrgName Text
OrgType Integer (Foreign Key to OrgTypes)
.... other Organizational fields

Table OrgType
-----------------
OrgTypeID AutoNumber (Primary Key)
OrgType Text

Sample OrgType Records
-----------------------------
OrgTypeID OrgType
=================
1 Customer
2 Supplier
....etc.

Then, on your switchboard to open the form, pass the name of the query as
the Filter parameter of the OpenForm method. For example, the OnClick event
procedure of a Suppliers command button would read:

stDocName = "YourFormName"
DoCmd.OpenForm stDocName, , "qrySuppliers"

For further information on why splitting a cohesive recordset into 2 or more
tables, Google the subject "Database Normalization".

Hope that helps.
Sprinks
 
Back
Top