Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8165457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:32:25+00:00 2026-06-06T19:32:25+00:00

I have an Access 2007 database and when I open it I can copy

  • 0

I have an Access 2007 database and when I open it I can copy and paste a table within the Access application. I can choose to copy structure only OR structure and data. In my case I just need the structure. The copy retains the indexes and keys of the original. I need to do this with VB.NET. So far I’ve looked at many articles and am able to copy the tables structure by issuing a SQL statment

Dim dbCmdInsert As New OleDbCommand
With dbCmdInsert
    .CommandText = "SELECT * INTO tmpTable FROM Trips WHERE 0=1;"
    .CommandType = CommandType.Text
    .Connection = connNavDb
    Dim n As Integer = .ExecuteNonQuery
End With

This copied the structure with no records which is what I want but the indexes and keys are lost. I cant seem to find good guidance on accomplishing this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T19:32:27+00:00Added an answer on June 6, 2026 at 7:32 pm

    Very roughly indeed:

        Dim oAccess As New Access.Application
    
        ''Open a database
        oAccess.OpenCurrentDatabase("z:\docs\test.accdb")
        ''"Import" table 
        oAccess.DoCmd.TransferDatabase(
            Access.AcDataTransferType.acExport, "Microsoft Access", "z:\docs\test.accdb", _
            Access.AcObjectType.acTable, "table1", "newtable1", True, False)
    

    See also c#: Copy Access table structure and constraints using C# or SQL

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have an MS Access 2007 database with a simple form displaying table data.
I have a table in an Access 2007 database. All fields are of type
I have an Access 2007 database being used for a website. The user can
I have an Access 2007 database that works asynchronously with a MAS200 database. Due
I have a database in access 2007 accdb extension , there are more or
I have the following problem in a Database using Access 2007 as front end
I have a site that uses classic ASP and a database in Access 2007
I have an Access 2007 database where I have two tables, exp_cash and exp_cheque.
I have a front-end Access 2007 database connecting to MySql tables using MySQL ODBC
Is it possible to have an ODBC connection to a MS Access 2007 database

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.