Show the selected customer as a property list
Build a form with a customer list on the left and the selected customer on the right as a property list that's edited in place and saved field by field.
Prerequisites
- Microsoft 365 Access or the Access Runtime, 32-bit or 64-bit, with the WKL Forms Object Library 1.38 or later installed and registered for the current Windows user (How to: Install the released package).
- A table
tblCustomerwith the fieldsID(Number, primary key),NameandCity(Short Text),Active(Yes/No), andSince(Date/Time), plus a few records. - Every WKL control opens its designer the same way: in Design view, open the property sheet (F4), go to the Other tab, and click
[...]in the Custom row (Opening the designer).
Steps
1. Insert the list and the property grid
Create a form named frmCustomers in Design view. Choose Form Design › Controls › ActiveX
Controls, insert WKL Grid, and name it Grid1. Then insert WKL Property Grid to its
right and name it Props1.
2. Bind the list
Select Grid1 and click [...] in the Custom row of the property sheet. On the Record
source page, set the record source to tblCustomer and the key field to ID. On the Columns
page, add Name and City. Click OK.
3. Link the property grid to the list
Select Props1 and open its designer ([...] in the Custom row):
- Record source page: record source
tblCustomer, key fieldID. - Link page: master
Grid1, child fieldID. - Rows page: add
NameandCity; then addActiveandSince, and typeStatusas their Category. GiveSincethe captionCustomer since.
The preview shows the lines: Name and City at the top, and the Status category with its two
fields below. Click OK and save the form.
4. Work with the form
Open frmCustomers in Form view and click a customer in the list: the property grid shows that
customer. Click City, type a new city, and press Enter; the value is written to tblCustomer when
you leave the line. Click the Status header to collapse the category. Up and Down move from line
to line, and Tab moves from value to value.
Expected result
The property grid follows the list, shows the customer's fields in two groups, and saves each changed field immediately. Until a customer is selected in the list, the property grid stays empty.
Next steps
- How to: Show a record as a property list: form mode without a record source, and read-only fields.