Solved

Copying an Access table with DAO

Posted on 1998-11-11
14
290 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Help on project with Soap 10 53
Printing problem 2 91
delphi parse string to params 3 121
Firemonkey DbLookupComboBox equivalent ? 2 47
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
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…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

813 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

18 Experts available now in Live!

Get 1:1 Help Now