Solved

Copying an Access table with DAO

Posted on 1998-11-11
14
292 Views
Last Modified: 2010-04-04
I am trying to copy an Access table (DAO 3.5). There are several ways to do this, but I must point out that I am using Titan Access for Delphi 3 and so any BDE usage is out of the question. However, Titan does provide the same functions as the BDE, although the DbiCreateTable function is not implemented.

Anyhow!

I have tried the following:

1. DAO "CopyObject" method. When I try this, the error message "OLE Automation Server does not support the CopyObject method." occurs. Has anybody managed to get this working?

2. BDE DbiCopyTable command. Because I am not using the BDE, but Titan, the error message "Engine not initialised" occurs, not surprisingly.

3. Titan's AccCopyTable method, which is identical to the BDE DbiCopyTable command. Error message: "DBIERR_NOTSUPPORTED". This is presumably because the Dbi_CreateTable command is not implemented as stated above, and I'm guessing that when copying a table, the CreateTable method is called first.

4. The actual TTable.CreateTable method. Nothing happens. No error message, no hanging, just nothing. When I step through the code, it just stops on that line but doesn't hang. I can still use the application.

5. The TTable.BatchMove method. See 4.

Anyone? I reckon the DAO CopyObject method MUST work somehow, but I'm not sure why delphi teels me it doesn't support it? Surely if I am using the OLE to talk to Access, then any Access commands should work. I used the CompactDatabase method and that worked fine.
0
Comment
Question by:jsweby
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 5
14 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1346559
hi jsweby,

i don't know nothing about titan access, but maybe it could be solved with an sql statement like this:

Query1.Close;
Query1.SQL.Clear;
{ Create new Table and Copy Data }
Query1.SQL.Add('Select * into YourDestinationTable from YourSourceTable');
Try
  Query1.ExecSQL;
Except
   { Problem Occured }
End;

meikl
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1346560
Hello? Is somebody here?
0
 
LVL 4

Author Comment

by:jsweby
ID: 1346561
Sorry, I wasn't emailed that you had replied first time!

I've actually got around this using a method similar to yours but it doesn't answer my original question, which is why can't I use the DAO's CopyObject method in Delphi?

Thanks though.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 27

Expert Comment

by:kretzschmar
ID: 1346562
hi jsweby,

its am alternate method. why you cannot use DAO's CopyObject i cannot answer, because i have no knowledge about titan access. Maybe it is really not supported.

meikl
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1346563
hi jsweby,

its an alternate method. why you cannot use DAO's CopyObject i cannot answer, because i have no knowledge about titan access. Maybe it is really not supported.

meikl
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1346564
Hello?
0
 
LVL 4

Author Comment

by:jsweby
ID: 1346565
I tried using the CopyObject method but Delphi says it is not supported by the OLE Automation Server. I don't understand that, I thought the OLE just did whatever the underlying application wanted.

I'm sorry for the lack of reply here, but the "Check here..." box is ticked but I'm not being emailed.
0
 
LVL 44

Expert Comment

by:bruintje
ID: 1346566
Hi Jsweby,

Looking through this pile of open questions,

My answer> No, If the method isn't supported you can't make the call. I used to have similar problems automating Office stuff, for example

With a Word obj you can't do objWord.Font = blue or something but have to call something like objWord.Selection = blue.

So even if the font is a property in Word you have climb down the tree and call a method or property through the tree and tweaks.
So CopyObject isn't supported but another method is, or maybe you have to look through the object model to search where the method you want to use is being implemented.

Hope this helps
:O)Bruintje
0
 
LVL 4

Author Comment

by:jsweby
ID: 1346567
bruintje,

Thanks for the comment, I'm sure you are right about not all methods being supported, although I don't really get this because the OLE server should just deal with whatever the underlying application can deal with, surely?

Anyway, I've tried looking around for other methods and in the end I decided to copy tables the hard way, i.e. creating a duplicate of the table I want to copy and copying all the fields and records across one by one. Slow and not pretty, but thanks to the OLE not supporting CopyObject and thanks to Titan not supporting the BDE's CopyTable method, not much choice left!
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1346568
Hi jsweby,

have you tried my first comment, before you copying field by field and record for record?

meikl
0
 
LVL 4

Author Comment

by:jsweby
ID: 1346569
meikl,

Yes, thanks, that is effectively what I am doing.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1346570
Hi  jsweby,

what will you do with the q, delete it or give me the points or give the points bruintje, or keep it alive?

meikl
0
 
LVL 4

Author Comment

by:jsweby
ID: 1346571
Make an answer & I'll give the points. First come...
0
 
LVL 27

Accepted Solution

by:
kretzschmar earned 100 total points
ID: 1346572
ok jsweby,

here is it.
best luck.

meikl ;-)

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses
Course of the Month7 days, 7 hours left to enroll

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question