Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updating database design

Status
Not open for further replies.

bjarvis

Technical User
Jan 15, 2001
38
0
0
US
I am creating a program that is connected to an access database. My question is, if in the future the user wants to add some new fields to the database, when I install the new version of the program how will I update the modified database with the information that the user has already entered.
 
If you add fields to a table the original data will stay put. Obviously you will have no data in the extra fields for the existing rows.
 
So if I install the new version of the database over the old version on the users machine, then the data on the users machine will transfer to the new database?
 
NO, data will not automatically transfer from one database to another!

1) If you are updating the code elements and maintaining the same database (and they are not the same file, e.g. a single Access database with both forms and data):
When you install a new version of your program, you also run a database update routine, that modifies the existing tables by adding new fields. These fields must either have a default value or allow nulls.

2) If you must replace the physical database, then:
First rename it the database.
Move your new empty database to the directory.
Run a series of queries to append all of the records from each data table in the old database to the new one. (If referential integrity is set, you will have to do this in a specific order)
 
Sorry, I went home shortly after writing my last bit. If I had have been here I would have written NO too!

As hirick says, you will need to import the existing data into the modified tables.

If you have a copy of Access this can help - attach the original tables, then write an append query to copy the data into the relevant fields.

If any of your new fields do not allow nulls you will have to provide some default data.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top