Home All Groups Group Topic Archive Search About

VB2005 : Create table in Access - copy of another table but without the data

Author
18 Oct 2006 11:04 AM
Screaming Eagles 101
Hi,
I'dd like to create a table in an Access MDB, which is a copy of an existing
table,
but without the data, only the structure.
--
Filip
http://www.ww2airborne.net/
Official Site of the 101st Airborne - 463rd PFA
skype: airborne463pfa-fiwi
-------------------------------------------------

Someone in the newsgroup comp.database.ms-access suggested I should ask it
here :

(((You can create a table using the SQL command "CREATE TABLE", but JET SQL
doesn't provide a means of creating a new table based on the schema of an
existing table. In VBA or VB 'classic' we would use DAO or ADOX to do
something like that. These are COM components, and you could use them from a
VB.NET app via COM Interop, but I am not at all convinced that this would be
the right way to go in a .NET app. My advise is to try asking again in
another .NET forum. Try microsoft.public.dotnet.framework.adonet.
--
Brendan Reynolds
Access MVP)))

Author
18 Oct 2006 11:55 AM
Kerry Moorman
Brendan,

You could use a Select Into statement to create the table structure without
data, but you would still need to add primary key, etc., using Alter
statements.

If you can't create the table using SQL then ADOX is your best bet.

Kerry Moorman


Show quote
"Screaming Eagles 101" wrote:

> Hi,
> I'dd like to create a table in an Access MDB, which is a copy of an existing
> table,
> but without the data, only the structure.
> --
> Filip
> http://www.ww2airborne.net/
> Official Site of the 101st Airborne - 463rd PFA
> skype: airborne463pfa-fiwi
> -------------------------------------------------
>
> Someone in the newsgroup comp.database.ms-access suggested I should ask it
> here :
>
> (((You can create a table using the SQL command "CREATE TABLE", but JET SQL
> doesn't provide a means of creating a new table based on the schema of an
> existing table. In VBA or VB 'classic' we would use DAO or ADOX to do
> something like that. These are COM components, and you could use them from a
> VB.NET app via COM Interop, but I am not at all convinced that this would be
> the right way to go in a .NET app. My advise is to try asking again in
> another .NET forum. Try microsoft.public.dotnet.framework.adonet.
> --
> Brendan Reynolds
> Access MVP)))
>
>
>
>
Author
18 Oct 2006 3:25 PM
Edwin Knoppert
Maybe in a transaction?

start TA
Copy one or more (all records)
Delete from target
Commit.


Show quote
"Kerry Moorman" <KerryMoor***@discussions.microsoft.com> schreef in bericht
news:7B4E843E-BC58-4AD1-A99F-6AD6E31B17C7@microsoft.com...
> Brendan,
>
> You could use a Select Into statement to create the table structure
> without
> data, but you would still need to add primary key, etc., using Alter
> statements.
>
> If you can't create the table using SQL then ADOX is your best bet.
>
> Kerry Moorman
>
>
> "Screaming Eagles 101" wrote:
>
>> Hi,
>> I'dd like to create a table in an Access MDB, which is a copy of an
>> existing
>> table,
>> but without the data, only the structure.
>> --
>> Filip
>> http://www.ww2airborne.net/
>> Official Site of the 101st Airborne - 463rd PFA
>> skype: airborne463pfa-fiwi
>> -------------------------------------------------
>>
>> Someone in the newsgroup comp.database.ms-access suggested I should ask
>> it
>> here :
>>
>> (((You can create a table using the SQL command "CREATE TABLE", but JET
>> SQL
>> doesn't provide a means of creating a new table based on the schema of an
>> existing table. In VBA or VB 'classic' we would use DAO or ADOX to do
>> something like that. These are COM components, and you could use them
>> from a
>> VB.NET app via COM Interop, but I am not at all convinced that this would
>> be
>> the right way to go in a .NET app. My advise is to try asking again in
>> another .NET forum. Try microsoft.public.dotnet.framework.adonet.
>> --
>> Brendan Reynolds
>> Access MVP)))
>>
>>
>>
>>

AddThis Social Bookmark Button