Results 1 to 10 of 10
  1. #1
    AYA is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2015
    Posts
    5

    Question How to copy paste Access Headers from datasheet view?

    Hello,

    I have a question regarding copy-pasting the access headers.
    I want to copy paste Access headers from a design view from one acess file to another file in the same format.
    Currently I can only copy-paste them one by one. Does anyone know how to copy paste it column by column?

    Thank you in advacne.

    BR,


    AYA

  2. #2
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,445
    a bit confused by what you are asking
    can you clarify what you mean by access headers - do you mean column headers? or perhaps labels/controls in a form or report header section?
    and what do you mean by 'another file in the same format' - is this a table (or form or report) in another db, a text file or excel perhaps?
    and how does copy paste one by one differ from copy paste column by column?

  3. #3
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    I am also having difficulty understanding what you need to accomplish and what you have in front of you.

    While in Design View of a form, you can select multiple controls in order to copy and paste multiple controls from one Access file to another Access file. You can select multiple controls by using the Ctrl key on your keyboard while you click a control. Also, you can select multiple controls by left clicking and swooping over multiple controls. You can copy selected controls by using the keyboard shortcut, Ctrl + C. Also, you can copy selected controls by using Right Click > Copy.

  4. #4
    AYA is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2015
    Posts
    5
    Hey!

    Apologies for not being clear at first.

    My starting point:
    I need to create an access file(target) that has metadata information about another access file with multiple tables(source).
    Thus, I want to go to the design view of my source file tables and copy paste columns describing the field names, field types and comments in the target access file.

    So my source file would look like this:

    ID Name
    10001 Chris

    Design View of my source file:

    Field Name Field Type Description
    ID Text Unique Identifier
    Name Text Optional


    My new access file metadata viewshould include all tables, I will add a new column with table names).
    Field Name Field Type Description
    ID Text Unique Identifier
    Name Text Optional

    Question:
    Is it possible to go to design view of my source file, copy the header and the field information (e.g. select and copy the whole column or the whole table in the design view instead of a single cell) and then paste it in another access file or another table within the same access file.

    Thank you very much in advance.

  5. #5
    AYA is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2015
    Posts
    5
    Hey!

    Apologies for not being clear at first.

    My starting point:
    I need to create an access file(target) that has metadata information about another access file with multiple tables(source).
    Thus, I want to go to the design view of my source file tables and copy paste columns describing the field names, field types and comments in the target access file.

    So my source file would look like this:

    ID Name
    10001 Chris

    Design View of my source file:

    Field Name Field Type Description
    ID Text Unique Identifier
    Name Text Optional


    My new access file metadata view should include all tables, I will add a new column with table names).
    Field Name Field Type Description
    ID Text Unique Identifier
    Name Text Optional
    Question:
    Is it possible to go to design view of my source file, copy the header and the field information (e.g. select and copy the whole column or the whole table in the design view instead of a single cell) and then paste it in another access file or another table within the same access file.

    Thank you very much in advance.

  6. #6
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,445
    to copy and paste, no. But you can reference the tabledefs collection and have a bit of vba to populate another table

  7. #7
    AYA is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2015
    Posts
    5
    Quote Originally Posted by Ajax View Post
    to copy and paste, no. But you can reference the tabledefs collection and have a bit of vba to populate another table
    Thanks for the response.
    1) Can you maybe share some more information on how to reference the tabledefs collection?
    2) I am more familiar with SQL than VBA. Would it be possible to use SQL instead of VBA?

    Thank you.

  8. #8
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,445
    you can't use sql to access tabledefs.

    to access the tabledefs collection you use

    currentdb.tabledefs

    for a particular table it would be

    currentdb.tabledefs("myTable")

    and to loop through all the tables it would be for example
    Code:
    dim tdef as tabledef
    
    for each tdef in currentdb.tabledefs
         debug.print tdef.name
    next tdef
    and to access the individual fields, you reference the tabledef fields collection
    Code:
    dim fld as dao.field
    for each fld in tdef.fields
        debug.print fld.name; fld.type
    next fld
    put it all together and you have

    Code:
    dim tdef as tabledef
    dim fld as dao.field
    
    for each tdef in currentdb.tabledefs
         debug.print tdef.name
         for each fld in tdef.fields
             debug.print fld.name; fld.type
         next fld
    next tdef
    or if you just want a specific table
    Code:
    for each fld in currentdb.tabledefs("myTable")
         debug.print fld.name; fld.type
    next fld

  9. #9
    AYA is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2015
    Posts
    5
    Thanks for the response.

    I must admit I ended up using excel to save time.
    However, your tips seem helpful.
    Can I ask where you would write these commands? (e.g. SQL scripts would go in the SQL view)

    Thanks.

  10. #10
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    While in design view of a form, you can open the VBA editor using Ctrl + G on your keyboard or by clicking the View Code button within the Ribbon. Code is placed in Procedures. You can create new procedures by typing them out. You can also create event handlers from design view of your form. By selecting a control, like a Command Button, you can view the available events from within the property sheet. Under the "Event" tab, you can click the ellipses(...) next to a corresponding event and then select "Code Builder".

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Copy to ACCESS in datasheet view
    By johnseito in forum Access
    Replies: 4
    Last Post: 07-26-2014, 11:01 PM
  2. Replies: 5
    Last Post: 01-24-2014, 01:36 AM
  3. Replies: 1
    Last Post: 07-16-2012, 01:26 PM
  4. Replies: 1
    Last Post: 12-18-2011, 01:52 AM
  5. Copy paste from CSV to Access 2010
    By mschmucker in forum Access
    Replies: 1
    Last Post: 12-16-2011, 04:33 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums