Results 1 to 7 of 7

Thread: How do I?

  1. #1
    Join Date
    May 2004
    Location
    New York State
    Posts
    1,178

    Unanswered:

    Select the table you want to copy structure and press <Ctrl><C>. Then Press <Ctrl><V> to paste, which will open a dialog box asking you for a table name and whether you want to copy structure and data, or structure only.

    Sam

  2. #2
    Join Date
    Feb 2004
    Location
    Irving, TX (Dallas, Fort Worth)
    Posts
    379

    VBA Please!

    I did specify VBA!

    DBS4M

  3. #3
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Ooh - this is fun! ??Guess the question??

    I presuem there was one before the problems....

    The only way I have found to do this is do get hold of a table or recordset object referencing the relevent structure, loop through the fields and build up a make table statement. Once built, execute the statement. Or you could create a new DAO tabledef object, loop through the fields of your recordset and use the createfield method of the table def to add new fields. Finally, use the Add method of the tabledefs collection.

    Does seem odd that there isn't a CreateACopy method in DAO or ADOX - unless someone can enlighten us....

    Of course, I might have guessed wrong at the question too....
    Testimonial:
    pootle flump
    ur codings are working excelent.

  4. #4
    Join Date
    Jan 2003
    Location
    Minneapolis
    Posts
    58
    I think the question was there yesterday and it was how to copy a table using VB, but only the structure.

    Probably the way I'd do it is with a docmd.copyobject and then call a macro that deletes all of the records of the newly copied table. It's not ideal, but the end result is the same.

  5. #5
    Join Date
    Sep 2005
    Posts
    17
    DoCmd.TransferDatabase() does the trick... it allows you to import the table from one database to into another (or in this case, the same database) as structure only...

    DoCmd.TransferDatabase TransferType:=acImport, DatabaseType:="Microsoft Access", DatabaseName:=CurrentDb.Name, ObjectType:=acTable, Source:="Table1", Destination:="Table2", StructureOnly:=True

  6. #6
    Join Date
    Feb 2004
    Location
    Irving, TX (Dallas, Fort Worth)
    Posts
    379

    Good

    Quote Originally Posted by axa1001
    DoCmd.TransferDatabase TransferType:=acImport, DatabaseType:="Microsoft Access", DatabaseName:=CurrentDb.Name, ObjectType:=acTable, Source:="Table1", Destination:="Table2", StructureOnly:=True
    Good StructureOnly:=True was what I was looking for!

    Thanks!

    DBS4M

  7. #7
    Join Date
    May 2004
    Location
    New York State
    Posts
    1,178

    Thanks, I learned something!

    Thanks, axa1001, I learned something today, too.

    Sam

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •