Board index » delphi » INSERT INTO IN SELECT FROM ????

INSERT INTO IN SELECT FROM ????

Hello,

I have a big problem !

I have two MS Access 97 Database-files.
I use use the components (TDAODatabase and TDAOQuery)
from Timur Islamov's Diamond Access (v 1.35) to connect to Delphi
3.02.

The first file is a Template database which has a table named
Elements:
dbTemplate: TDAODatabase;
qrElementsT: TDAOQuery;

The second file is an Analysis database which also has a table named
Elements:
dbAnalysis: TDAODatabase;
qrElementsA: TDAOQuery;

A user fills an Elements table in a new empty Template database, which
works fine.

When the user starts an analysis, a new empty Analysis database is
connected to dbAnalysis and the Elements table from the Template
database must be copied to the Elements table in the Analysis
database.

I tried to do this with the following SQLstatement, run from the
source: qrElementsT.SQL:

frmTOCWAnalysis.qrElementsT.SQL.Add('INSERT INTO qrElementsA IN
dbAnalysis SELECT * FROM qrElementsT');

When executed, I get an error that it can't find qrElementsT...
I already tried too many different possibilities, replacing the qr..
with real paths etc., but nothing seems to work.

Executing normal SELECT statements with ORDER etc always works fine.

I don't know why it goes wrong. Can someone help me, please ? :)

Thanks,

Adrian.

 

Re:INSERT INTO IN SELECT FROM ????


Are you sure this is correct syntax for the INSERT statement?

Juan

Quote
Adrian wrote:

> Hello,

> I have a big problem !

> I have two MS Access 97 Database-files.
> I use use the components (TDAODatabase and TDAOQuery)
> from Timur Islamov's Diamond Access (v 1.35) to connect to Delphi
> 3.02.

> The first file is a Template database which has a table named
> Elements:
> dbTemplate: TDAODatabase;
> qrElementsT: TDAOQuery;

> The second file is an Analysis database which also has a table named
> Elements:
> dbAnalysis: TDAODatabase;
> qrElementsA: TDAOQuery;

> A user fills an Elements table in a new empty Template database, which
> works fine.

> When the user starts an analysis, a new empty Analysis database is
> connected to dbAnalysis and the Elements table from the Template
> database must be copied to the Elements table in the Analysis
> database.

> I tried to do this with the following SQLstatement, run from the
> source: qrElementsT.SQL:

> frmTOCWAnalysis.qrElementsT.SQL.Add('INSERT INTO qrElementsA IN
> dbAnalysis SELECT * FROM qrElementsT');

> When executed, I get an error that it can't find qrElementsT...
> I already tried too many different possibilities, replacing the qr..
> with real paths etc., but nothing seems to work.

> Executing normal SELECT statements with ORDER etc always works fine.

> I don't know why it goes wrong. Can someone help me, please ? :)

> Thanks,

> Adrian.

Other Threads