473,513 Members | 2,881 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Design Question -> Copying a table in another database, the relinking it.

Hi all,

I have a situation where I have a split database. At the back end, I
need to
- create a new table (I will call it newTable) with the exact fields,
and relationships as another table (let's call it oldTable, and I need
to copy everything EXCEPT the data).

- Then I need to delete oldTable, and rename newTable 'oldTable'

The problem is, that all of this happens at the back end, and I'm
having some problems making this work.

I've tried using CreateTableDef, and this creates the
definitions...but it never manages to actually create a table (that I
can see).

I've also tried the following SQL,
SELECT * INTO newTable FROM oldTable Where 0 = 1;

The 0=1 will never occur, thus I will have a new table with the proper
definitions, but no data...which is what I want. But this creates a
table at the front end :( I need a table at the back end which is
linked...

Anyone have any ideas?

Mark

Jul 13 '07 #1
5 1880
Copy oldTable. Paste. When you paste you will be given three options. One
will allow you to copy the structure only.
Easier though to open the oldTable, press Ctrl+a and then press delete.
Voila! All the data is gone and you have a blank oldTable.

mark_aok wrote:
>Hi all,

I have a situation where I have a split database. At the back end, I
need to
- create a new table (I will call it newTable) with the exact fields,
and relationships as another table (let's call it oldTable, and I need
to copy everything EXCEPT the data).

- Then I need to delete oldTable, and rename newTable 'oldTable'

The problem is, that all of this happens at the back end, and I'm
having some problems making this work.

I've tried using CreateTableDef, and this creates the
definitions...but it never manages to actually create a table (that I
can see).

I've also tried the following SQL,
SELECT * INTO newTable FROM oldTable Where 0 = 1;

The 0=1 will never occur, thus I will have a new table with the proper
definitions, but no data...which is what I want. But this creates a
table at the front end :( I need a table at the back end which is
linked...

Anyone have any ideas?

Mark
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200707/1

Jul 13 '07 #2
On Jul 13, 11:10 am, "jahoobob via AccessMonster.com" <u12179@uwe>
wrote:
Copy oldTable. Paste. When you paste you will be given three options. One
will allow you to copy the structure only.
Easier though to open the oldTable, press Ctrl+a and then press delete.
Voila! All the data is gone and you have a blank oldTable.

mark_aok wrote:
Hi all,
I have a situation where I have a split database. At the back end, I
need to
- create a new table (I will call it newTable) with the exact fields,
and relationships as another table (let's call it oldTable, and I need
to copy everything EXCEPT the data).
- Then I need to delete oldTable, and rename newTable 'oldTable'
The problem is, that all of this happens at the back end, and I'm
having some problems making this work.
I've tried using CreateTableDef, and this creates the
definitions...but it never manages to actually create a table (that I
can see).
I've also tried the following SQL,
SELECT * INTO newTable FROM oldTable Where 0 = 1;
The 0=1 will never occur, thus I will have a new table with the proper
definitions, but no data...which is what I want. But this creates a
table at the front end :( I need a table at the back end which is
linked...
Anyone have any ideas?
Mark

--
Message posted via AccessMonster.comhttp://www.accessmonster.com/Uwe/Forums.aspx/databases-ms-access/2007...
I'm really sorry, I forgot to mention that I need to do this using
VBA.

So far I have code to copy the table definitions, but the problem is
copying the relationships. I know how to do this manually, and I
could easily tell my users how to do this, but it would be MUCH more
conveniant, if there was a way to copy a table's relationships into
the new table. This is the part that's killing me right now.

Mark

Jul 13 '07 #3
As jahoobob said, why don't you just delete each and every record on
oldTable?

The final result will be the same as if you created a new empty table,
dropped the old full table and renamed the new empty table to "old",
won't it?
On Jul 13, 12:39 pm, mark_aok <mark_...@hotmail.comwrote:
On Jul 13, 11:10 am, "jahoobob via AccessMonster.com" <u12179@uwe>
wrote:


Copy oldTable. Paste. When you paste you will be given three options. One
will allow you to copy the structure only.
Easier though to open the oldTable, press Ctrl+a and then press delete.
Voila! All the data is gone and you have a blank oldTable.
mark_aok wrote:
>Hi all,
>I have a situation where I have a split database. At the back end, I
>need to
>- create a new table (I will call it newTable) with the exact fields,
>and relationships as another table (let's call it oldTable, and I need
>to copy everything EXCEPT the data).
>- Then I need to delete oldTable, and rename newTable 'oldTable'
>The problem is, that all of this happens at the back end, and I'm
>having some problems making this work.
>I've tried using CreateTableDef, and this creates the
>definitions...but it never manages to actually create a table (that I
>can see).
>I've also tried the following SQL,
>SELECT * INTO newTable FROM oldTable Where 0 = 1;
>The 0=1 will never occur, thus I will have a new table with the proper
>definitions, but no data...which is what I want. But this creates a
>table at the front end :( I need a table at the back end which is
>linked...
>Anyone have any ideas?
>Mark
--
Message posted via AccessMonster.comhttp://www.accessmonster.com/Uwe/Forums.aspx/databases-ms-access/2007...

I'm really sorry, I forgot to mention that I need to do this using
VBA.

So far I have code to copy the table definitions, but the problem is
copying the relationships. I know how to do this manually, and I
could easily tell my users how to do this, but it would be MUCH more
conveniant, if there was a way to copy a table's relationships into
the new table. This is the part that's killing me right now.

Mark- Hide quoted text -

- Show quoted text -

Jul 13 '07 #4
I have a situation where I have a split database. At the back end, I
need to
- create a new table (I will call it newTable) with the exact fields,
and relationships as another table (let's call it oldTable, and I need
to copy everything EXCEPT the data).
This doesn't sound logical as multiple users may need to perform this same
action at the same time, which is impossible this way. What exactly is it
that you're trying to achieve? There may be a better solution.

john
"mark_aok" <ma******@hotmail.comschreef in bericht
news:11**********************@q75g2000hsh.googlegr oups.com...
Hi all,

I have a situation where I have a split database. At the back end, I
need to
- create a new table (I will call it newTable) with the exact fields,
and relationships as another table (let's call it oldTable, and I need
to copy everything EXCEPT the data).

- Then I need to delete oldTable, and rename newTable 'oldTable'

The problem is, that all of this happens at the back end, and I'm
having some problems making this work.

I've tried using CreateTableDef, and this creates the
definitions...but it never manages to actually create a table (that I
can see).

I've also tried the following SQL,
SELECT * INTO newTable FROM oldTable Where 0 = 1;

The 0=1 will never occur, thus I will have a new table with the proper
definitions, but no data...which is what I want. But this creates a
table at the front end :( I need a table at the back end which is
linked...

Anyone have any ideas?

Mark

Jul 13 '07 #5
On Jul 13, 1:25 pm, "John" <j...@hn.comwrote:
I have a situation where I have a split database. At the back end, I
need to
- create a new table (I will call it newTable) with the exact fields,
and relationships as another table (let's call it oldTable, and I need
to copy everything EXCEPT the data).

This doesn't sound logical as multiple users may need to perform this same
action at the same time, which is impossible this way. What exactly is it
that you're trying to achieve? There may be a better solution.

john

"mark_aok" <mark_...@hotmail.comschreef in berichtnews:11**********************@q75g2000hsh.g ooglegroups.com...
Hi all,
I have a situation where I have a split database. At the back end, I
need to
- create a new table (I will call it newTable) with the exact fields,
and relationships as another table (let's call it oldTable, and I need
to copy everything EXCEPT the data).
- Then I need to delete oldTable, and rename newTable 'oldTable'
The problem is, that all of this happens at the back end, and I'm
having some problems making this work.
I've tried using CreateTableDef, and this creates the
definitions...but it never manages to actually create a table (that I
can see).
I've also tried the following SQL,
SELECT * INTO newTable FROM oldTable Where 0 = 1;
The 0=1 will never occur, thus I will have a new table with the proper
definitions, but no data...which is what I want. But this creates a
table at the front end :( I need a table at the back end which is
linked...
Anyone have any ideas?
Mark
Hey, the purpose of this is to uncorrupted the database. I have
written code which takes the contents of a table, and copies the non-
corrupted data to a new table. But to do so, I needed to copy the
relationships, and the definition of the table first.

Thanks for everyone's input, but I think I'm on the right track now.
It turns out DAO has everything needed
DAO.relationship, and Database.Relationships contain pretty much
everything I need. Thanks for all the input though,

Mark

Jul 13 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3119
by: Omer van Kloeten | last post by:
The Top Level Design: The class Base is a factory class with a twist. It uses the Assembly/Type classes to extract all types that inherit from it and add them to the list of types that inherit from it. During run time, using a static method, the class creates an instance of the derived class using the Activator class and returns it. This...
3
4117
by: zlst | last post by:
Many technological innovations rely upon User Interface Design to elevate their technical complexity to a usable product. Technology alone may not win user acceptance and subsequent marketability. The User Experience, or how the user experiences the end product, is the key to acceptance. And that is where User Interface Design enters the...
16
2302
by: sailor.gu | last post by:
Hi all guys, As an embeded programmer with five year C experience, I did read many great books related with design, coding, test,debug,algorithms, compiler, design, os, pm and others. I always dream to achieve a refined and reusable design and implementation. I am very interested with code reuse.
2
2358
by: Paul Cheetham | last post by:
Hi, I have moved an application from VS2003 to VS2005, and I am now unable to view most of my forms in the designer. The majority of the forms in my project are derived from class PACForm, (which itself derives from System.Windows.Forms.Form) Whenever I try to open on of these forms in the designer, I get an error, stating it is unable...
0
2493
by: YellowFin Announcements | last post by:
Introduction Usability and relevance have been identified as the major factors preventing mass adoption of Business Intelligence applications. What we have today are traditional BI tools that don't work nearly as well as they should, even for analysts and power users. The reason they haven't reached the masses is because most of the tools...
6
2122
by: JoeC | last post by:
I have a question about designing objects and programming. What is the best way to design objects? Create objects debug them and later if you need some new features just use inhereitance. Often times when I program, I will create objects for a specific purpose for a program and if I need to add to it I just add the code.
19
3134
by: neelsmail | last post by:
Hi, I have been working on C++ for some time now, and I think I have a flair for design (which just might be only my imagination over- stretched.. :) ). So, I tried to find a design certification, possibly that involves C++, but, if not, C++ and UML. All I could find was Java + UML design certifications (one such is detailed on...
8
2207
by: indrawati.yahya | last post by:
In a recent job interview, the interviewer asked me how I'd design classes for the following problem: let's consider a hypothetical firewall, which filters network packets by either IP address, port number, or both. How should we design the classes to represent these filters? My answer was: class FilterRule {
10
3620
by: vital | last post by:
Hi, I am designing the middle tier of a project. It has 6 classes and microsoft application data access block. The six classes are DBServices, Logger, ProjectServices ... etc. and all these classes talk to front-end directly. Do I need to use any design pattern in this? or what kind of design pattern is this?
4
2447
by: Ken Fine | last post by:
I've been living with a frustrating issue with VS.NET for some months now and I need to figure out what the problem is. Hopefully someone has run into the same issue and can suggest a fix. I suspect some permissions problem. I'm running VS.NET 2008 in Vista. Symptoms and observations: * ASP.NET's native ImageMap and Image controls work...
0
7269
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7177
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7394
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7123
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7542
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5100
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3248
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3237
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
811
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.