Solved

Copying an Access table with DAO

Posted on 1998-11-11
14
285 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
  • 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
 
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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

747 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now