This tutorial require to already have some basic knowledge in creating Access forms and VBA code manipulation.
Introduction
We will create a form with two lists of products: one with a list of all products, and another to put the list of selected products. Selecting a product will be done via a drag and drop from one list to another.
As you probably already know, Access does not support drag / drop (hence the importance of this tutorial
). For this, we will use the events mouse up / down and the mouse position.
Preparation of the database structure
Products table
We are going to create a very simple "tbProducts" table to store all our products.
| tbProducts | |
| idProduct | Auto Number (Key) |
| ProductReference | String (50) |
| ProductDescription | String (255) |
| ProductIsSelected | Yes / No |
Fill then this table with a few records.

Sub form of non selected products
Create a new form with the following properties:
- Default View: Continuous Forms
- Record Selectors: No
- Navigation Buttons: No
- Dividing Lines: No
- Record Source: SELECT * FROM tbProducts WHERE ProductIsSelected=0;
- Allow Additions: No
- Scroll Bars: Vertical Only
Save the form with the name "sfrmProductsNotSelected".
Add a form header, the fields ProductReference, ProductDecription, idProduct, ProductIsSelected and a button.

Specify the following parameters:
- Name of the form header: FormHeader
- Name of the detail section of the form: FormDetail
- Name for the fields ProductReference and ProductDescription, Enabled = No and Locked = Yes
- For the fields idProduct and ProductIsSelected, Visible = No
Sub form for the selected products
As we are lazy, we will just make a copy / paste of the previous from and name it "sfrmProductsSelected".
You then just have to change the Record Source property to : SELECT * FROM tbProducts WHERE ProductIsSelected=-1;
Creation of the main form
We will now create the main form containing the two lists of products. The structure will be as follows (sorry for the french!):

Create a new form named "frmProducts" with the following parameters:
- Default View: Single Form
- Record Selectors: Yes
- Navigation Buttons: No
- Dividing Lines: No
- Scroll Bars: None
- Name of the detail section: FormDetail
Then, in design mode, drag / drop in two forms created above.
With a little effort of formatting, you should get something like this:

That's it, we have the basis, we can now go to the more serious part!
- Prev
- Next >>