473,382 Members | 1,329 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Copy database design to new database

Hello everyone,

Im quite new to MS Access (i am using MS Access 2003 on Windows XP ) and i have a little question ( i hope).

I have created a small database application and it is up and running nicely.I would like to create a copy of this database but i need all the tables to be empty. My question is: Is there a way to copy only the design elements of a database (without the data in the tables) into a new one?

Any help would be appreciated.
Thanks,
Christina
Jan 30 '07 #1
17 2917
NeoPa
32,556 Expert Mod 16PB
I think the safest way, ensuring you have everything exactly the same except for the data in the tables, would be to :
  1. Make a file copy of your database.
  2. Open the database in Access.
  3. Create a quick routine in a general purpose module to process through all tables (CurrentDB.TableDefs) and empty them (Use SQL in the form DELETE FROM [TableName]).
  4. Compact & Repair the database.
Let me know if you need help creating the routine. I've done similar things a couple of times before so it shouldn't be too hard if you need it.
Jan 31 '07 #2
Killer42
8,435 Expert 8TB
  1. Make a file copy of your database.
  2. Open the database in Access.
  3. Create a quick routine in a general purpose module to process through all tables (CurrentDB.TableDefs) and empty them (Use SQL in the form DELETE FROM [TableName]).
  4. Compact & Repair the database.
Why just create new db and use Import function? Worried about missing something?
Jan 31 '07 #3
NeoPa
32,556 Expert Mod 16PB
If you import the objects across you then still need to empty the tables.
But yes, a number of items or properties are not stored in the main containers.
You could go through with a fine tooth-comb but it's easier to explain and execute the other method I thought.
Jan 31 '07 #4
MMcCarthy
14,534 Expert Mod 8TB
If you import the objects across you then still need to empty the tables.
But yes, a number of items or properties are not stored in the main containers.
You could go through with a fine tooth-comb but it's easier to explain and execute the other method I thought.
You can actually copy and paste the tables accross. You will be given the option of structure only or structure and data. The only issue is you will need to re-enter the table name each time.

Mary
Jan 31 '07 #5
Killer42
8,435 Expert 8TB
If you import the objects across you then still need to empty the tables.
But yes, a number of items or properties are not stored in the main containers.
You could go through with a fine tooth-comb but it's easier to explain and execute the other method I thought.
Fair enough, I suppose the copy-and-wipe leaves much less scope to miss things.

However, I do take exception to the "still need to empty the tables" statement. When importing tables, you have the option to import Definition and Data or Definition only.
Jan 31 '07 #6
Killer42
8,435 Expert 8TB
You can actually copy and paste the tables across. You will be given the option of structure only or structure and data. The only issue is you will need to re-enter the table name each time.
Wouldn't you also lose any relationships? Not to mention import/export specs, and who knows what else?
Jan 31 '07 #7
MMcCarthy
14,534 Expert Mod 8TB
Fair enough, I suppose the copy-and-wipe leaves much less scope to miss things.

However, I do take exception to the "still need to empty the tables" statement. When importing tables, you have the option to import Definition and Data or Definition only.
You are of course right Killer and this also allows you to set the options so that relationships, specs, etc are imported.

This is by far the best solution.

Mary
Jan 31 '07 #8
NeoPa
32,556 Expert Mod 16PB
Fair enough, I suppose the copy-and-wipe leaves much less scope to miss things.

However, I do take exception to the "still need to empty the tables" statement. When importing tables, you have the option to import Definition and Data or Definition only.
My bad - simple ignorance.
I wasn't aware at that level of detail :(
Jan 31 '07 #9
MMcCarthy
14,534 Expert Mod 8TB
My bad - simple ignorance.
I wasn't aware at that level of detail :(
At least you have an excuse. I just didn't put my brain in gear :D

Good catch Killer.
Jan 31 '07 #10
NeoPa
32,556 Expert Mod 16PB
You are of course right Killer and this also allows you to set the options so that relationships, specs, etc are imported.

This is by far the best solution.

Mary
I would actually still recommend my original approach.
There are still numerous properties that will not be transferred using this (import the various individual objects) approach. Many of them, undoubtedly quite insignificant. I prefer to know exactly what I'm doing though so would have to check them all out first before being sure, thus losing any benefit of the method.
These properties (like Startup settings; module names; password & Security settings; various other database properties) can be reset afterwards but that still creates extra, unnecessary work.
Jan 31 '07 #11
Killer42
8,435 Expert 8TB
You are of course right Killer and this also allows you to set the options so that relationships, specs, etc are imported.

This is by far the best solution.
Thanks.

But in fact unless I'm moving a single table or query, I usually tend to use NeoPa's method of copying the MDB then zapping the data. I tend to have queries sitting around with names like "Q Zap everything!". :)

I was just sort of playing devil's advocate, to get the options thrashed out here.
Jan 31 '07 #12
MMcCarthy
14,534 Expert Mod 8TB
I would actually still recommend my original approach.
There are still numerous properties that will not be transferred using this (import the various individual objects) approach. Many of them, undoubtedly quite insignificant. I prefer to know exactly what I'm doing though so would have to check them all out first before being sure, thus losing any benefit of the method.
These properties (like Startup settings; module names; password & Security settings; various other database properties) can be reset afterwards but that still creates extra, unnecessary work.
True for startup settings and password and security settings but shouldn't be a problem with module names.
Jan 31 '07 #13
Killer42
8,435 Expert 8TB
I would actually still recommend my original approach.
There are still numerous properties that will not be transferred using this (import the various individual objects) approach. Many of them, undoubtedly quite insignificant. I prefer to know exactly what I'm doing though so would have to check them all out first before being sure, thus losing any benefit of the method.
These properties (like Startup settings; module names; password & Security settings; various other database properties) can be reset afterwards but that still creates extra, unnecessary work.
Oh! Security settings - forgot about those. :o

I never bother with them. In fact I think the only database I ever created with any security on it (beyond setting read-only attribute on the MDB:)) was in Access 2, back around early 90's.
Jan 31 '07 #14
NeoPa
32,556 Expert Mod 16PB
Oh! Security settings - forgot about those. :o
That perfectly illustrates why I prefer to avoid that sort of approach. Not because of the problems I know to expect, but for those I don't foresee and only find out about later :o
I have had to use it though, when my db got corrupted and before I found a way around it.
In fact I think the only database I ever created with any security on it (beyond setting read-only attribute on the MDB:)) was in Access 2, back around early 90's.
You've been using Access longer than I have then. I thought I was the vet ;)
Jan 31 '07 #15
Killer42
8,435 Expert 8TB
That perfectly illustrates why I prefer to avoid that sort of approach. Not because of the problems I know to expect, but for those I don't foresee and only find out about later :o
Amen!

...You've been using Access longer than I have then. I thought I was the vet ;)
I've been using it for a loooong time, but not professionally. I mostly just dabble a bit, which is why I don't know as much about it as I should.

I've been a dabbler in VB since version 1, and bought Access when it was originally released, at a hugely reduced promotional price.
Jan 31 '07 #16
Hello All,

Thanks alot for your responses.
i am going to use mary's approach of copying the tables from one db to another since my application is pretty simple and therefore small :)


Thank you all again for helping me out of jam, i really appreciate it.

Christina.
Jan 31 '07 #17
NeoPa
32,556 Expert Mod 16PB
Certainly, if your database is relatively small and it consists fundamentally of the main Databse objects (Tables; Querydefs; Forms; Reports; ASPs; Modules; etc) then that will work perfectly for you.
Jan 31 '07 #18

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: sqlnewbie | last post by:
I'm a newbie to script writing. I'm trying to write a script to copy all data from a table to the same table in a 2nd database. Both databases are on the same server and are identical in design. ...
42
by: Edward Diener | last post by:
Coming from the C++ world I can not understand the reason why copy constructors are not used in the .NET framework. A copy constructor creates an object from a copy of another object of the same...
5
by: Don Vaillancourt | last post by:
Hello all, Over the years as I design more database schemas the more I come up with patterns in database design. The more patterns I recognize the more I want to try to design some kind of...
6
by: Sally Sally | last post by:
I wanted to dump the contents of one table to another (with a different name) within the same database. I am looking at pg_restore and it doesn't seem to have the option of specifying the name of...
7
by: ShyGuy | last post by:
Is ther a way to copy a table, from the backend of a split database, into a database on another machine from the front end?
19
by: Khafancoder | last post by:
Hi guys, in my db i have these three tables 1.Stores 2.Products 3.Parts their structure is something like : Stores ----Products ----Parts
2
by: miroku800 | last post by:
A little history I designed a program in VB6 which used an access database with the aid of a then workmate (who has now moved on and lost interest) which was in two parts. A master program and a...
0
by: Laurynn | last post by:
# (ebook - pdf) - programming - mysql - php database applicati # (Ebook - Pdf)Learnkey How To Design A Database - Sql And Crystal Report # (ebook-pdf) E F Codd - Extending the Database Relational...
1
by: asnoble | last post by:
hey, I am trying to copy and make a stand-alone database. When I try to import tables i get this error: You do not have necessary permissions to use S:/.........mdb Have the system admin or the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.