Using a single form to access many different tables

  • Thread starter Thread starter steve
  • Start date Start date
S

steve

Hello

I have a number of code tables that all have the same structure and I am
looking for a way of parameterising a form so that it can access different
tables.

I don't really want to have to build 40 identical forms.

Is this possible or should I start copying my base form and change the
record source?

Any advise is gratefully received.

Cheers

Steve
 
It is possible to do this...you need to make it possible for the
recordsource for the form to be changed programmatically. How you do this
is a matter of design choice. A couple of possible methods:

1) Have a drop list in the form header that lists the tables, and then
insert code in the afterupdate event for the drop list that changes the
recordsource
2) Use OpenArgs to specify which table to use and insert code for form_load
that changes recordsource based on value of openargs
 
Why don't you just add one new field to that table that has the table name,
and then merge all 40 tables into one table?

You will then easily be able to summarize data across your tables, and only
one form, and one report will solve this whole mess.

So, I would simply add one new field to the table that distinguishes each
table.

Hence, you can get rid of 40 tables.
 
Back
Top