Video: Controlling input with option groups

Yes/No Data Type fields have several different ways that the user can interact with them. The most common is with a Checkbox an Option Button or a Toggle Button. We can also group several of these elements together in what is called an option group to deal with more complex data entry. We are going to continue working with a simple form to capture product reviews that we created in the last movie. I will double-click to open it and we will see that we can select an oil name from this drop-down menu and entering comments here that we want to add to our Review. Let me go ahead and open up this Reviews table. I will double-click on it to open and we will see that the Reviews table also has two fields, one for Rating, here, which is the numerical value and one for Public.

Discover how to manage data entry and reporting tasks more efficiently using Access 2010. Author Adam Wilbert presents lessons on designing forms, organizing and displaying data with form controls, creating flexible queries, and building a form-based navigation system. The course also shows how to build reports from wizards and queries, highlight important data with conditional formatting, and automate reporting processes with macros.

Controlling input with option groups

Yes/No Data Type fields have several different ways that the user caninteract with them.The most common is with a Checkbox an Option Button or a Toggle Button.We can also group several of these elements together in what is called an optiongroup to deal with more complex data entry.We are going to continue working with a simple form to capture product reviewsthat we created in the last movie.I will double-click to open it and we will see that we can select an oil namefrom this drop-down menu and entering comments here that we want to add to our Review.Let me go ahead and open up this Reviews table.I will double-click on it to open and we will see that the Reviews table alsohas two fields, one for Rating, here, which is the numerical value and one for Public.

A Checkbox or Yes/No data type that says whether or not we can use the review on our website.I am going to go ahead and close this table down and we will change our formatto Design View, here.I am going to go up to the controls up at the top and I am going to use the Morebutton to open that Controls Panel.Now the Checkbox Control is this one right here.This one that looks like an eyeball is our Option button, and over here on theleft, is our Toggle button.It's the one with the rectangle and two different states.We are going to add each of these to our form, and then connect them to theYes/No Public box on the Reviews form.We will click on the checkbox and add one in.I will scroll down and add this Option button here, and I will add one to myform and I will scroll down and add a Toggle button, and I will put that in my form as well.

When you first add these in, they are unbound.They're not connected to this Reviews table in any way.I do need to identify which field this control.I can do that in the Data tab of the Property Sheet.If it's not open, you can toggle the Proper Sheet with this button here orpress Alt+Enter or F4.The Control Source field, is this the drop-down menu where I can select thefield that I want to connect it to.In this case, I'm going to connect it to Public.And I'm going to connect with radio button and the checkbox to Public as well.Make sure you click on the radio button, not the label;we will go to Control Source and choose Public.

Now I will click on the checkbox, Control Source and Public.So now all of three of these elements are connected to the exact same field.Let's go and take a look at our form.I will change to Form View, and I can see that this first review of 5, thecheckbox is turned on.All of these are active.As I scroll through my records, record number 2, it's turned off.If I were to toggle one of them, they'll change state at the same time.That's because they are connected to all, the exact same field in this table.Okay, let's go back in the Design View.I am going to go ahead and get rid of two of these, and the checkbox is the mostcommon option that people are familiar with, so I am actually going to get ridof these other two interface elements.

We are just going to stick with the checkbox.I'm going to change the label for this checkbox to, May we use your comments on the website.I will double-click to edit it and I will move this up below the comments box.Now I want to add a control, so that they can enter any product rating.I could just have type in a value, but some people will type in five stars orthree or some other random numbers, so I won't be able to control this a little bit more.What I can do is use what's called an Option Group.Up here in the Control section, the Option Group is this one here with the whiterectangle on the XYZ across the top.

I will click that on, and I will just add an Option Group down here.When I do that, the wizard starts.The first thing that it wants to know is what are the labels?These are going to be what the end user sees.So I want to make sure that they are clear.I'm going to put in the five selections that I want them to choose from.The first one is going to be Excellent followed by Good then Average, then BelowAverage and then Poor.Once I get those five labels typed in, I will go ahead and say Next.The next screen asks if I want to make a default choice.Now I don't want to skew my results at all, so I am going to say no, I don'twant to default choice.Go ahead and say Next.And then it wants to know what values do I want to associate with the label?So again, the users are going to see what it says on the label.

The value is what's going to be saved in my data table.I am actually going to want to reverse these numbers, Excellent is going to bea 5 rating, Good will be a 4 rating, Average is 3, Below Average is 2 and Poor is 1.Go ahead and say Next.The last screen is going to ask, do I want to save the value for later use orstore the value in a field.So we are connecting this to our Reviews table, so I want to store this in afield and I'm going to connect it to my Ratings field.Go ahead and say Next.We have a choice of how we want this to display;we can either choose an Option button, a Checkbox or a Toggle button.Now in standard User Interface practices, checkboxes typically mean thatthe user can select multiple options or as an Option button, they can only check one.

So in this instance, I would probably avoid the checkbox.I would either choose the Option button, or the Toggle button.In this case, I'm going to choose the Option button.We can also add a style to the line around the edge here.You can either leave it Etched, Flat, Raised, Sunken or Shadowed, let's goahead and say Next.Finally, it's going to ask what do I want to name this.This is the title that's going to appear here.Instead of Frame10, I'm going to choose Rating and say Finish.That adds the Option button group to my form.Let's go ahead and rearrange the elements a little bit.I can highlight everything up here.And select them this way and I'll Shift+Click just like those labels.

I'm going to move that up to the top, then I will move all of the rating stuffover to the right side.Finally, I am going to make my form a little bit shorter, so I will scroll at the bottom.I will drag this back up to the top and I am going to change the labels here,instead of Combo3, this is going to be Product.Now I can move these over to align them up a little bit, I will use thesehandles in the top left, drag them over and we will drop them there.Finally, I'm going to right align the text, so that all the labels are aligned together.We will go in the Format tab, and say right aligned.Okay, let's check out our form, we will go back to Home tab, switch to FormView, and there is our finished form.

I can see that the first review is for this particular oil.This is the comment, it's public and they gave it a rating of Good.I can scroll through the different reviews or I can add my own.We will go to the next blank one, choose a product to review, about the Mission Oil.They can use it on the website, we will give it a good rating and we can type in any comments.We will click this pencil icon to finish the review and we can double-check thetable to make sure that it got entered.And it looks like all the values came in.So the Option Group gave us a good way to translate what we want to store inthe database, this numerical rating, to a different sort of tag that'spresentable to our end users.

So we were able to use a Checkbox and Option button or Toggle button, tointerface with the Yes/No Public field here.And we used a Control group to translate the numerical value that we wanted tostore on our database, to something that's a little more user-friendly to ourend-users, the text tag, of what their rating is.

There are currently no FAQs about Access 2010: Forms and Reports in Depth.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.

Already a member ?

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships.
Learn more

Upgrade to our Annual Premium Membership today and get even more value from your lynda.com subscription:

“In a way, I feel like you are rooting for me. Like you are really invested in my experience, and want me to get as much out of these courses as possible this is the best place to start on your journey to learning new material.”— Nadine H.

Thanks for signing up.

We’ll send you a confirmation email shortly.

Sign up and receive emails about lynda.com and our online training library:

new course releases

newsletter

general communications

special notices

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

new course releases

newsletter

general communications

special notices

Here’s our privacy policy with more details about how we handle your information.