From the course: Access 2019: Forms and Reports

Form controls for Yes/No data types

From the course: Access 2019: Forms and Reports

Start my 1-month free trial

Form controls for Yes/No data types

- Our product feedback form currently has a combo box and we can use this to select from all the different products that the company sells. We also have a text box to capture feedback from our end users, as well as text box to capture the customer id that's leaving the feedback. And all of three of these pieces of information are being fed back into feedback table. If I open up this table though, we'll see that we have a couple of additional columns that we're not yet capturing on that form. Specifically, we have the public column which is a yes or no data type here, that's represented by these check boxes in the table, and we also have a numerical field here for ratings. Yes or no data type fields can have several different ways that the user can interact with them. The most common is with a check box, option button, or a toggle button. We can also group several of these elements together in what's called an option group to deal with more complex data entry like we have for the rating column. So let's continue working with the product feedback form and add controls that will work with both of these columns. I'm going to go ahead and close the table, and from the product feedback form, we're going to go ahead and switch it into design view. First let's tackle the yes or no public field. In the controls group on the design tab of the ribbon, I'm going to press the more button to expand that window open, and there's a couple of controls that I want to take a look at. The first one is the check box control, it's this one here. It looks like a giant check box. Let's go ahead and click on it, and come down into our form, and I'll just click again, to add in a new check box. Then I'll come back up into the controls group, press the more button once again, and I'm going to choose this one here, that's an option button, or sometimes it's called a radial button. It looks like a giant eyeball. I'll go ahead and click on that, and then come down and then I'll click to add an option button. One more time and we'll come up to the controls group and press the more button again, and this time I'm going to choose this one here. It's called a toggle button. It looks like two rectangles, they're two buttons, and they're in different states. I'll select that, and then come down into my form and click again to add in an option button. Now just like the text box that we added in a previous movie, each one of these controls comes in an unbound state which means that they aren't currently connected to a data source in the feedback table yet. We can fix this by selecting each one and going over here to the property sheet, switching to the data tab, and finding the control source property. I'll use the drop down menu, and we're going to connect each one of these to the public field. That takes care of the toggle box. I'm going to go ahead and select the radial button or the option button, we'll do the same thing for the controls source, set it to the public field, and we'll do the same thing for this check box. I'll change it's control source to public. Now each one of these is connected to the exact same field in the underlying data table. Let's switch our view into form view and take a look at how this looks. For the first record, you can see that that option is checked on, and you can see that all three of these are active, the check box, the radial button, and the toggle button are all set to yes. Let's go ahead and scroll through a couple of these records here, and when I get to number three, we can see that that is currently deselected, so all three of these simultaneously will turn off. If I wanted to change the state of this option, I can simply check any one of these, and it will turn on. So that's how you can use a check box, option button, or a toggle button to control or connect to a yes or a no data type field. Let's go back into design view. For this particular form I only want to use the check box control, so I'm actually going to delete the other two. I'll just drag a box around all three of these options, the option button, the label here, and the toggle button, and press the delete key on my keyboard. Then I'll click on the check box and I'll click and drag it into position here. Then I'll select the label, and using the handle in the upper left hand corner, I'll drag it over here to the left, and I'm going to make it wider, and then I'll highlight the text, and I'll just change it to say public.

Contents