martin.lindenlauf
martin.lindenlauf

Reputation: 394

create table (structure) from query (MS-Access)

I like to create an empty table from a (pivot) query in Microsoft Access (using Office 365 1902). With the help of this post I found a solution with one shortcoming:

SELECT TOP 1 * INTO tblNew FROM qryMyQuery;

The shortcoming is that tblNew contains one record which needs to be deleted to get an empty table. Access 365 can not process SELECT TOP 0 * INTO.

I post this primarily because other people may have the same question and run into the same problem. I can work with my solution, but maybe somebody has a better one?

Upvotes: 0

Views: 143

Answers (1)

Erik A
Erik A

Reputation: 32652

The solution is very simple:

SELECT * INTO tblNew FROM qryMyQuery WHERE False;

Since the WHERE condition matches 0 rows, 0 rows get copied.

Upvotes: 1

Related Questions