Advanced Database – bound controls: combo box

Create, modify, delete bound controls: combo box

Replace the Staff Number entry box with a Combo Box.

A combo box allows you to select from a list or manually enter data.

3 Properties Combo

Right click and select ‘Control’

You have the options to change the empty string result or set input required, but with a combo box you can also define the contents of the list.

4 Properties Combo Table

Select ‘Type of list contents’ dropdown menu and choose ‘Table’. We could select SQL and write a statement for what follows, but it’s easier this way.

Select ‘List content’ dropdown menu and click the ‘Mechanics’ table.

This sets the combo box up so the list is going to be generated from the matching field in the Mechanics table, which is what we want.

Click save and close.

5 Database Form

Open the form in entry mode by double clicking it.

If you click on the list arrow in the combo box next to staff number, you will see a list of values to choose from that correspond to the Staff Numbers in the Mechanics table.

As it is a combo box, we can also enter a value manually by typing it in.

Close the window.

6 SQL Command

Another way to select the list contents is to choose a query or to use an SQL statement.

Go to the Control properties for the combo box and select ‘Sql’ for the type of list contents.

Press the ‘…’ symbol next to List content and type: SELECT “Staff Number” FROM “Mechanics”.

This has the same effect as the last example, generating the list from the Staff Number field in the Mechanics table.