Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
1Activity
0 of .
Results for:
No results containing your search query
P. 1
msaccess

msaccess

Ratings: (0)|Views: 18|Likes:
Published by kumars_ddd
Best Practice
Best Practice

More info:

Published by: kumars_ddd on May 13, 2008
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

06/14/2009

pdf

text

original

 
Access > Queries Using multivalued fields in queriesIn Microsoft Office Access 2007, you can create a field that holds multiple values, such as a list of people to whom you have assigned an issue. Multivalued fieldsare appropriate for certain situations, such as when you use Office Access 2007 to work with information stored in a Microsoft Windows SharePoint Services 3.0list, and that list contains a field that uses one of the multivalued field types available in Windows SharePoint Services 3.0.This article discusses multivalued fields and how to use them in queries.In this articleWhat is a multivalued field?Introducing queriesDisplaying a multivalued field in a queryDisplaying the individual values in a multivalued fieldUnderstanding the bound value and the display value in a lookup fieldHow to display the bound value in a queryEntering simple query criteria for a multivalued fieldSearching for more than one value in a multivalued fieldUnderstanding the impact of including a .Value field in the field list.Counting, grouping and using other aggregate functionsUsing an Append query with a multivalued fieldUsing an Update query with a multivalued fieldUsing a Delete query with a multivalued field Top of PageWhat is a multivalued field?Suppose you have a task to assign to one of your employees or contractors, but you decide that you need to assign it to more than one person. In Office Access2007, you can create a multivalued field that lets you select the people from a list.When you click the combo box, check boxes appear selected to indicate your choices. You can check or clear items in the list and then click OK to submit yourchoices.The selected people are stored in the multivalued field, and are separated by commas (by default) when displayed.
 
The idea behind multivalued fields is to make it easy to support those instances where you want to select and store more than one choice, without having to createa more advanced database design. Multivalued fields are also important for integration with Windows SharePoint Services because SharePoint lists also supportmultivalued fields.You might wonder why Office Access 2007 allows you to store more than one value in a field, when most relational database management systems forbid this. Theanswer is that the database engine in Office Access 2007 doesn't actually store the values in a single field. Even though what you see and work with appears to be asingle field, the values are actually stored independently and managed in hidden, system tables. The Access database engine handles this for you, automaticallyseparating the data and bringing it back together again to surface the values in one field.Technically speaking, an Access multivalued field models a many-to-many relationship. For instance, consider an events table where you assign responsibility foreach event to one or more of your employees. Suppose you create a multivalued field named "AssignedTo" for assigning events to employees. The relationshipbetween events and employees is many-to-many. That is, you can have many employees assigned to any one event, and you can also have any one employeeassigned to many events. Top of PageIntroducing queriesDatabases exist for the primary purpose of serving up information: "What's our best-selling product? Who's our best customer? Where are we not meeting oursales targets?" All are questions that you might legitimately ask of a well-designed database. To get the answers from your Access database, you create a queryand enter the needed criteria. The data in a query can come from one or more tables. After Access retrieves the data that answers your question, you can view andanalyze the data. Once you’ve created a query, you can use it as the basis for a form, report, graph, or even another query.Office Access 2007 lets you employ multivalued fields in certain queries and in certain ways. You can display a multivalued field in a query, display the individualvalues in a multivalued field in a query, and perform certain selected aggregate operations and action queries using multivalued fields. Top of PageDisplaying a multivalued field in a queryWhen you display a multivalued field in a query, you must decide if you want to display the complete multivalued field containing all of the values separated bycommas, or a separate row for each value. For example, suppose you have an Issues table that contains an AssignedTo field that you use to assign issues to people.You can construct a query that contains the AssignedTo field by using the following procedure.Click the Microsoft Office Button , and then click Open.In the Open dialog box, select and open the database.On the Create tab, in the Other group, click Query Design.In the Show Table dialog box, click the table (in this example, "Issues") that contains the multivalued field, and then click Add.Click Close.Drag the fields that you want to use to the query design grid. In this example, drag the Title field and the multivalued field named AssignedTo to the query grid.On the Design tab, in the Results group, click Run.Your query result will look something like the following figure — one column displays the issue title and the second column displays the multivalued field:
 
When you create a query using Design view, Access automatically generates the corresponding SQL (Structured Query Language) statement. SQL is the querylanguage that Access uses. You can switch to SQL View to see the SQL statement by using the following procedure.On the Design tab, in the Results group, click the arrow under View to display the View menu .Click SQL View.The SQL statement looks like this:SELECT Issues.Title,Issues.AssignedToFROM Issues; Top of PageDisplaying the individual values in a multivalued fieldSuppose you want to see the AssignedTo multivalued field expanded (sometimes called flattened) so that each name or AssignedTo value appears in a separate row.To do this, you need to specify the Value property by appending the string ".Value" to "AssignedTo" in the Field row, as shown here in the query grid:When you specify AssignedTo in the Field row, Access displays all of the values in the multivalued field in just one row when you run the query. However, whenyou use the Value property, as in AssignedTo.Value, Access displays the multivalued field in expanded form so that each value appears in a separate row. You cancreate a query to display the individual values by using the following procedure.Click the Microsoft Office Button , and then click Open.In the Open dialog box, select and open the database.On the Create tab, in the Other group, click Query Design.In the Show Table dialog box, click the table (in this example, "Issues") that contains the multivalued field, and then click Add.Click Close.Drag the fields you want to use (in this example, the multivalued field named "AssignedTo.Value") to the query grid.On the Design tab, in the Results group, click Run.When you create a query by using Design view, Access automatically generates the corresponding SQL (Structured Query Language) statement. SQL is the querylanguage that Access uses. You can switch to SQL view to see the SQL statement by using the following procedure.

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->