Creating Tables   «Prev  Next»

Lesson 5 Using Cut, Copy and Paste to enter data more quickly
ObjectiveEnter, edit and copy data in Access.

How to Cut, Copy and Paste Cells in MS Access to enter Data more quickly

Depending on the data you are entering, you may find that there are times when you just want to copy a piece of data rather than retyping something that you have already typed. If you know how to copy and paste in another Windows application, you probably already know how to do it in Access. Here are the specifics:
  1. First, select the data you want to copy.
  2. Press Ctrl-C, click the Copy button, or choose Edit>>Copy from the menu.
  3. Move the cursor to where you want to copy the data.
  4. Press Ctrl-V, click the Paste button, or choose Edit>>Paste from the menu. The data will be copied to the new location.
There are three easy ways to complete the cut, copy, and paste actions: you can use the keyboard, the toolbar, or the menu. View the table below to see a quick-reference table.
ActionWhat it doesKeyboardToolbar buttonMenu choice
CutDeletes the selected text and stores it on the clipboardCtrl-XAccess CutEdit>>Cut
CopyCopies the selected text to the clipboardCtrl-Ccopy to clipboardEdit>>Copy
PastePastes the contents of the clipboard to the cursor’s locationCtrl-VPastes the contents of the clipboard to the cursorEdit>>Paste

Access 2000 had a new feature that you may not be familiar with, where it allows you to store multiple “clips” on the clipboard and paste them where you want. This flexibility can be very useful, as you will see. If you are entering repeating data use Ctrl-’ – it repeats the data in the record above for the current field.

Cutting and Pasting Test in Microsoft Access

Cutting and pasting can be especially useful when you are first building your database, especially if you decide to restructure tables that already have data in them. You can copy more than one cell of data at a time. I find the easiest way to select a few cells of data is to click at the beginning of the first cell and then Shift-click at the end of the data I want to select. You can also select entire columns or rows by clicking on the row or column header. And once you have selected the data, you can copy or cut it to the clipboard and copy it to a new location, perhaps even a different table.
The clipboard can be a useful tool for copying data from another application such as Excel or Word. In the next lesson you will learn about importing data from another application. You may find that you do not need all the bells and whistles offered by the import feature, you can get by simply copying the data you need to the clipboard and then pasting it into an Access table.

API Compatibility with Microsoft Access

Using VBA and type libraries allows you to provide a tremendous amount of flexibility when creating Access 2016 applications. Sometimes, however, you must communicate directly with the operating system of the computer and other components (such as when you manage memory or process or work directly with the user interface elements such as windows or controls, or when modifying the Windows Registry). In these situations, your best option is to use external functions that are embedded in dynamic-link library (DLL) files. You accomplish this in VBA by making API calls using Declare statements. Making API calls is discussed in greater detail in Chapter 9 of this book. Microsoft provides a Win32API.txt file that contains approximately 1,500 Declare statements plus a tool for cutting and pasting the Declare statement into your code. Unfortunately, these statements are for 32-bit systems. You will need to convert any of these statements to 64-bit versions before using them in your 64-bit application. Declare statements are used to incorporate API calls into your code. They will take on one of two types:
  1. subroutine or
  2. function.
A subroutine cannot provide a return value when called, but a function may provide a return value when called. The following is an example of incorporating an API element of either type:
[Public|Private] Declare [Function|Sub] Name Lib 
`` LibraryName Alias `` AliasName _(argument list)

Replace the placeholder (Name) with the actual name of the procedure from the DLL library and replace the placeholder LibraryName with the name of the DLL file that contains the sub or function you wish to incorporate. The Alias argument is optional and allows you to assign your own name to the sub or function for use later in your application. It is useful to use an alias to prevent possible confusion in your code. The (argument list) must contain the parameters and data types that are to be passed to the procedure. Here is an example of incorporating an API function for opening and replacing a subkey in the Windows Registry:
Declare Function RegOpenKeyA Lib 
advapi32.dll (ByVal KEY AS Long, ByVal SubKey _As String, NewKey As Long) As Long

In Microsoft Visual C or Visual C++ the previous example will compile correctly for both 32-bit and 64-bit systems. This is because HKey is defined as a pointer and its size directly reflects the platform it is compiled on. Prior versions of VBA, however, do not have a pointer data type so the long data type was used. Because the long data type is always 32-bit, it would break on systems using 64-bit memory space. The upper 32 bits of memory space would either be truncated or would overwrite other memory addresses. This behavior would cause unpredictable results or even system crashes. In the following series of images I will show you an easy way to complete a table using the multiple clip feature for cutting and pasting.


Cut, Copy and Paste in MS Access

1) The first step is to select the text I need and copy it to the clipboard. The first text I need is Network Consultants, Inc.
1) The first step is to select the text I need and copy it to the clipboard. The first text I need is Network Consultants, Inc.

2) As soon as a second piece of text is copied to the clipboard the Clipboard toolbar appears.
2) Nothing changes on the screen to indicate to you that you have stored text on clipboard, but it is there, and if you move the cursor and click the Paste button, you will see the copied text pasted to the new location. However, I am going to copy the two other piece of data that you need before pasting anything. I select AZ and click the Copy button to copy the text to the clipboard.
3) As soon as a second piece of text is copied to the clipboard the Clipboard toolbar appears.
3) As soon as a second piece of text is copied to the clipboard the Clipboard toolbar appears. It contains two icons, one for each piece of information that is stored. Then I select the text Dynamic Solutions, Inc. and click the Copy button to copy that text to the clipboard also.


4) The Clipboard toolbar now has three icons, since three pieces of text are stored there.
4) The Clipboard toolbar now has three icons, since three pieces of text are stored there.

5) I move the cursor to the Company column for Catherine Molkenbur.
5) I move the cursor to the Company column for Catherine Molkenbur.

6) Next I move the cursor to the State column for Catherine Molkenbur and copy AZ by clicking the second icon on the clipboard toolbar.
6) Next I move the cursor to the State column for Catherine Molkenbur and copy AZ by clicking the second icon on the clipboard toolbar.

7) Hillary works for Dynamic Solutions, so I move the cursor to the Company field for Hillary and click the third icon on the clipboard toolbar to paste that text.
7) Hillary works for Dynamic Solutions, so I move the cursor to the Company field for Hillary and click the third icon on the clipboard toolbar to paste that text.

8) All I need to do now is put in Hillary's state and Piper's information. Piper also works for Dynamic Solutions.
8) All I need to do now is put in Hillary's state and Piper's information. Piper also works for Dynamic Solutions.

Cut Copy Paste - Exercise

Enter data into your Clients table in this exercise.
Cut Copy Paste - Exercise

SEMrush Software Target 5SEMrush Software Banner 5