[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Copying an Access table with DAO

Posted on 1998-11-11
14
Medium Priority
?
295 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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 200 total points
ID: 1346572
ok jsweby,

here is it.
best luck.

meikl ;-)

0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
The video will let you know the exact process to import OST/PST files to the cloud based Office 365 mailboxes. Using Kernel Import PST to Office 365 tool, one can quickly import numerous OST/PST files to Office 365. Besides this, the tool also comes…
If you are looking for an automated solution for backup single or multiple Office 365 user mailboxes to Outlook data file, then you can use Kernel Office 365 Backup & Restore tool. Go through the video to check out the steps to backup single or mult…

607 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