I have a table in access database named TABLE1.
Is possible via VB6 or vba for excel to create, into the same database, a new table balnk named TABLE2 only with the same name and structure of TABLE1?
create table only with structure fileds
-
- PlatinumLounger
- Posts: 4370
- Joined: 26 Apr 2010, 17:36
-
- Administrator
- Posts: 78627
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: create table only with structure fileds
Try this SQL string
SELECT * INTO TABLE2 FROM TABLE1 WHERE False
SELECT * INTO TABLE2 FROM TABLE1 WHERE False
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4370
- Joined: 26 Apr 2010, 17:36
Re: create table only with structure fileds
Hi Hans, sorry for delay, but very busy!HansV wrote:Try this SQL string
SELECT * INTO TABLE2 FROM TABLE1 WHERE False
the code work perfect! but not copy the property of index, i need to indexed field1 andf field2 with the duplicates admittet?
Is possible ?
-
- Administrator
- Posts: 78627
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: create table only with structure fileds
Surely you don't need to do this all the time? You can copy the structure of a table (with all indexes, but without records) easily within Access: simply copy the table, then paste it. The VBA for this (within Access!) would be
DoCmd.TransferDatabase acImport, "Microsoft Access", CurrentProject.FullName, acTable, "TABLE1", "TABLE2", True
DoCmd.TransferDatabase acImport, "Microsoft Access", CurrentProject.FullName, acTable, "TABLE1", "TABLE2", True
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4370
- Joined: 26 Apr 2010, 17:36
Re: create table only with structure fileds
OK... but i can to use into a vba for excel, is correct?HansV wrote:Surely you don't need to do this all the time? You can copy the structure of a table (with all indexes, but without records) easily within Access: simply copy the table, then paste it. The VBA for this (within Access!) would be
DoCmd.TransferDatabase acImport, "Microsoft Access", CurrentProject.FullName, acTable, "TABLE1", "TABLE2", True
-
- Administrator
- Posts: 78627
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: create table only with structure fileds
Yes, you can use Automation to control Access from VBA in Excel. See Wendell's tutorial Automation 101 for a short introduction and useful links.
Best wishes,
Hans
Hans