Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ms-access: difference between control source and row source

Tags:

sql

vba

ms-access

i have learning reports in access and i don't understand the difference between these two concepts. i understand that the control source is the column? but then what is the row source?

like image 587
Alex Gordon Avatar asked May 11 '10 17:05

Alex Gordon


People also ask

What is a control source in access?

The Control Source is the field in a table your combo box is linked to, it could also be a query or an SQL statement. Either way it will display the data in that field and any updates you make to the combo box will be reflected in that field (unless it's a non-update-able query).

What is Access row source?

The information that appears in a list box is specified by a property called the Row Source. The Row Source can contain a table name, query name, or an SQL statement. We want to build SQL statements for each list box to display the correct information for each customer.

Where is the control source in access?

You can find the Control Source property on the Data tab on the Property Sheet. Click the Data tab. Set the Control Source property to determine what is displayed in the control.


1 Answers

Row Source is typically used to determine how to build a list of items whereas Control Source determines what field will be used to store or retrieve the value. For example, in a Combo Box you have both properties. The Row Source determines how to build the list the user sees when they hit the down arrow. The Control Source determines where to store the value that the user selects.

EXAMPLE Suppose we have a form that is bound to table called Cars which lists information about automobiles. One of the columns in this table is used to store the color of the car. Let's suppose that column is named BodyColor. You also have another table of allowed colors (e.g. Blue, Yellow, Green, Steel Blue, Midnight Blue etc.). You want to ensure that users choose from this list of colors when they enter a value for the car's color.

On our form we add a Combo Box where we set the following properties:

Control Source  :   BodyColor
Row Source      :   SELECT Colors.Name FROM Colors ORDER BY Colors.Name;
Row Source Type   :   Table/Query

When a user sees your Combo Box, they will be able to hit the down arrow on the Combo Box and see a list of colors. When they choose a color, the Form will save their selection into the BodyColor column.

like image 87
Thomas Avatar answered Sep 30 '22 20:09

Thomas