Copying a Table from Access to Somewhere Else in Access 2007

Microsoft Access Add comments

Access lets you copy a selection of rows or an entire table to another program, without going through the hassle of the Export wizard. Access copies these rows to the clipboard as an intelligent object that can convert itself into a variety of software-friendly formats. You can paste them as Excel cells, HTML text (the formatting language of the Web), or RichText (a formatting standard created by Microsoft and supported by all major Word processors). Since HTML and RichText are so widely supported, you’ll almost never have a problem copying your rows into another program when you use this technique.

Here’s how to try it out:

  1. If you want to copy an entire table, then, in the navigation pane, select the table. If you want to copy only a few rows, then select them in the Datasheet view, as shown in Figure 10-1.

    You’re not limited to copying tables. You can also copy a query’s results. Just select the query in the navigation pane. You can’t copy reports or forms, however.

    When you copy rows or an entire table, Access takes your column hiding settings (Section 3.1.4) into account. If you’ve hidden a column so it doesn’t appear in the datasheet (by selecting it, and then choosing Home Records More Hide Columns), Access doesn’t copy it to the clipboard. This technique helps you leave out information you don’t want to copy.


    Figure 10-1. When selecting rows in the datasheet, click the gray margin just to the left of the first row you want to select. Then, drag down to select as many rows as you want. If you don’t want to take your hand off the mouse, then you can copy these rows by holding down the Ctrl key, and right-clicking one of them. Then, from the pop-up menu, choose Copy.


    Note: You can copy only a contiguous selection of rows, which is a fancy way of saying you can copy only rows that are right next to each other. If you have 10 rows in a table, then you can copy rows three to six, but you can’t copy just the first and last rows. (Of course, you can use several smaller copy operations to get the stragglers.)

  2. Hit Ctrl+C to copy your selection.

    This action places the records on the Windows clipboard. You can now paste it inside Access or in another program.

  3. Switch to the program where you want to paste your information.

    If you’re just trying this feature out for the first time, then take a whirl with Excel or Word (shown in Figure 10-2).


    Figure 10-2. Using cut and paste, you can transform a database table into a table in a Word document (shown here). Once you’ve pasted the content, you may need to fiddle with column widths to make sure it all looks right.

  4. Hit Ctrl+V to paste your selection (see Figure 10-2).

    Access pastes the rows from your selection, complete with column headers. If you’ve applied formatting to the datasheet (Section 3.1.1), then most of that formatting comes along.

    Depending on the program where you paste your records, you might see a smart tag icon appear at your newly pasted content’s righthand corner. In Office appli-cations, you can use this smart tag to change options about how the data’s pasted (for example, with or without formatting).


Note: Copying text, numbers, and dates is easy. However, some data types don’t make the transition as well. If you copy an attachment field, then the pasted content shows the number of attachment fields, but the files themselves are left out.


TIMESAVING TIP
Copying from One Database to Another

You can also use the copying trick described in Section 10.2.1 to copy data from one Access database to another Access database that’s open in a separate window. However, it works only if you’re copying a complete table (or other object), not a selection of rows.

To try it out, right-click the object you want in the navigation pane, and then choose Copy. Then, switch to the second Access database, right-click in the empty space in the navigation pane, and then choose Paste. Access asks you what you want to name the pasted table, and gives you three pasting options:

  • Structure creates the table structure, but leaves it empty.

  • Structure and Data creates an exact duplicate of the table, with all the data.

  • Append Data to Existing Table doesn’t create a new tableinstead, it adds the data to the table that you specify. For this to work, the table must have the same structure as the one you’ve copied.

This trick also lets you create a duplicate copy of a table (or other object) in the same database.

Popularity: 13% [?]

Related Post

  • Cut, copy, and paste in Access 2007
  • Copying the Presentation to a CD in Powerpoint 2007
  • Copying Formatting from One Section to Another in Word 2007
  • Creating an Append (or Make-Table) Query in Access 2007
  • Copying Cells from Excel into Access in Access 2007
  • Don't Find What You're Looking For? Please Try Here...

    Google
     

    Leave a Reply

    WP Theme & Icons by N.Design Studio
    Entries RSS Comments RSS Add to Technorati Favorites Log in