How to create a combo control on a login form

Once you can comfortably create tables, queries, and forms in Access, you may want to focus more on designing your forms to make sure your database is really easy to use. One way to do this is to use one or more combo controls for data entry. Combos allow the user to select data from a list rather than having to type it from scratch, so it can be a faster and easier way to add data and avoids the hassle of users typing abbreviations or misspellings. This article shows you how to create a Combo on an existing form.

So what really is a combo? Combo stands for “Combination” and once the control is added to a form, the user can click the down arrow to display a list of options. Clicking either option adds that data to the table. Alternatively, the user can type their own data into the actual box. Therefore, Combo allows data entry via popup window or direct input, hence the name Combination.

Suppose you created an Access database and then created a table that lists all of your workbooks. This Books table has these headers (fields); Book ID, title, author, date obtained and type. You then use the Form Wizard and create a columnar form based on this table using all of its fields. Columnar forms display each record in a single column and make it easy to view existing records or add new ones.

Since you’ll be getting help entering your book details, you want to change the “Type” box on the form to a Combo and offer only four options, Fiction, Nonfiction, Travel, or Science. This way, when you or your helper add a new book record, the data for “Type” is added through the popup window that shows all four options.

With your Books Table open, switch to Design view. You will see a grid pattern that contains all of your form headers. Each title has a white box, which is used for data entry, and a label that identifies the title on the form. Click once on the white “Type” box to select it. Then from the top toolbar choose Format, Change To, Combo Box. You will now see a combo for the “Type” header.

Next, we’ll tell Access which options you want in the Combo dropdown box. So, with the “Type” combo still selected, click the button on the properties toolbar (the button has a hand pointing to a page). The Combo property sheet is now displayed. In the property sheet, make sure the “All” tab is selected. Then look for the “Row Source Type” heading which should by default say “Table/Query”. Change this using the pop up window to “List of Values”. List of values ​​means that we will tell Access what values ​​to offer. Then look at one of the headings below to “Row Source” and click the white box to the right.

Type, including quotation marks and semicolons, “Fiction”; “Non-fiction”; “Trip”; “Science”, then close the property sheet, save the form layout change, and return to normal form view. His “Type” Combo should be alive and well, so we’ll give it a try. Use the bottom navigation bar to select any record, then try changing the “Type” using the Combo and select one of your four options.

If the resulting box is not wide enough on the form to display the data correctly, you can easily resize the box. To do this, switch back to form design view and select the white “Type” combo again. You will see small black sized handles around the box. Hover over the handle on the right vertical edge until the cursor displays a two-way arrow, then drag to the right to enlarge the white box. Save the form layout change and go back to normal form view and check that the size of the box is now the correct size.

If you use the combo like this, you’ll find that a user can ignore the popup options and type whatever text they want into the box. It is quite common in Access database design to prevent users from being able to do this, so data can only be entered through the popup window. To do this, switch back to form design view, select the Combo control, and activate its property sheet. Further down in the properties, under the “All” tab, you’ll see “Limit to List”. Change this from “No” to “Yes”. Save your form design change, go back to form view and try “Type” one more time.

You will now find that Access only allows selected data from the drop down list. Try typing some other text and then click outside the box. You will receive an Access error message “The text you entered is not an item in the list.” Click OK and you will return to the Combo, so you must choose one of the options to continue.

Once you start using Combos, you may need to be able to change the popup options. For example, you may decide to add a new book type “Comics” (perhaps for the books in the attic). You can edit merged properties in form design view, but it can be a hassle to do it more than once.

If your data for the Combo dropdown is likely to change from time to time, you can create a table that lists all of your book types. Then in the Combo property sheet, in the form design view, change “Row Source Type” back to “Table/Query” and change “Row Source” by clicking on its popup to select your table which list all types. Then save the form layout, switch back to form view, and try the modified Combo. If you later add a new type to the Types table, using the “Types” combo on the form will include the new type in the popup.

You can also use Combos in other ways, for example, to set search criteria in a search form. To learn even more about the power of Access, consider attending one of the many available training courses and accelerate your Access skills.

Website design By BotEap.com

Add a Comment

Your email address will not be published. Required fields are marked *