Discussion Locked

Change of Table names and primary keys

0 helpful
11 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi, Gurus,
I just began to take over a new Access 2000 project from a db developer who left our company. The CEO of my company don't like the table names and some of the primary key settings and wanted me to change them once in all. I can't figure out how a good way to do this.

Here is what I'd like to do:
1.)Change one table name and all forms, querys, reports, macros, modules in the who Access 2000 database should reference to this new table name automatically.
2.)to change the primary key in one table should also automatimally change the foreign key in another table

I wonder if this is possible. Or, I have to do manually one by one?

Any idea?

11 replies

by kevin.riggs

My hubmle opinion is that changing table names and key names just because someone doesn't like them is petty and says more about the CEO than about your predecesor's ability to build a db application. Perhaps there is a good technical reason to change table structure or relationships; maybe a business object needs to be modelled differently. But to change names and primary keys unless it is in an attempt to better model business objects and rules is irresponsible and could be dangerous to theapplication.

That's my $0.02

by bob sellman

First of all, I agree with Kevin. Your new CEO should be interested in the end result. (He's probably also worrying about how the toilet paper comes off the rolls, over or under!)

Rather than wasting your time on such activity, why don't you look over and fix what is displayed on the forms, reports, etc.? Just because an internal name of "LName" was used doesn't mean the user should ever see that. The user probably should see something like "Last name". In fact, the user should never have to see the internal names. (You can even use the caption property of each column in a table to display text other than the internal column name.)

Do you allow users direct access to the query builder? There's a system I've designed with a query/sort interface that allows a user to specify selection and sorting criteria on whatever table or query you wish to give the user access to and display the results (either all detailed records or subtotals based on the sorting) or used a where and order by clauses to apply to a form or report. All displayed items are controlled by data you enter into a table. If you'd like a copy of the sample database with this system, let me know. If there's a way to post it on Tech Republic, I'd be willing to do that so others could use it.

As a last resort, check around for Access utilities (in sites besides Microsoft.com). There are a number of tools available, some of which should do part or all of what you want. (Of course, they do cost money--see how your CEO likes that!) Even the utilities may not be perfect, but they should be better than trying to do it by hand if you CEO continues his nano-management. I haven't used any of the tools and don't remember where I've read about them, so I can't even give you any names to start with.

Or...get a new CEO???

by frescalus

I do not believe that foreign keys will change automatically. You will have to 1) delete the relationships in order to change your primary keys then 2) change the primary keys to what you want, then 3) redo your relationships. When you redo your primary keys you have to watch because if you have, for example, myorders.custid that is the same as myorders.custid and they are both primary keys, then you will have a 1 to 1 relationship when you redo relationships.

As far as your forms, querys,etcs, etcs, automatically updating when you change the table name, I doubt that is possible either. Just like with primary keys, you will have to go in manually and change them in your SQL statements, forms, and what not in design view.

Of course I could be wrong.

Neil

by lo

Hi - Agree with 1-3. Unless a good reason to modify the metadata (table, column, etc.), no real benefit & a lot of work. Even if you find a tool to help, your app down until you get all chg & test.

Did some when I playing with Access (97 & prior). Didn't like the col/tbl names, not desc enough or too desc. I did during devel, didn't impact prod.

I chg prim names as I remember. Had to remove prim key, chg & rekey. Did a glbl sea/repl for chgs to get querys, forms, etc. Wasn't complex app & only chg a few ent, not too bad.

If your app is cmplx, try create dup db new forms, queries, tbl, col, etc. Mod & test copy till you get workign. Del all data & copy tbls from prod db to new db (may have to specify field:field rel map for chg names, I haven't done but should work). May be able to exp / imp data.

If users of db see metadata, giving col, tbl, queries, etc. names that assist them is a valid bus reason to modify. If ojection is that Form shows LNAME, FNAME, CNAME, ADDR1, etc. rather Last Name, First Name, Customer Name, First Address, just change form lbl. Leave metadata as it is.

If you determine just form lables & such, do it. If metadata needs changed, make copy of production system & so some changes to get some idea of complexity & time required for ea type of change. Estimate time it will take (time for change type * # changes). Estimate chg time for each col, tbl, form, query, etc. Remember to include ripple effect in process. Present estimate to management (estimate both effort & calendar time, if you work on changes 75% of time 1 week is 1.3 weeks clock time( (40 hours / .75) /40). If mgt stil wants it changed, change it. If may be stupid & waste of effort, that is our opinion. It's mtg's $ (paying us for the effort). Our job is to give them sufficient data to allow them to make an informed business decision. If they make a not so good one, well, ... lo

by m_ozog

Where I work we use a program called Speed Ferret. This program will allow you to change the table\query\form names all at one time.

The program won't help with the key fields though.

This discussion is closed to new replies.