Microsoft KB Archive/234986

= ACC2000: How to Set Multiple Sort Order Values on a Data Access Page =

Article ID: 234986

Article Last Modified on 6/23/2005

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q234986



Advanced: Requires expert coding, interoperability, and multiuser skills.

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).



SUMMARY
This article shows you how to create an HTML page that sorts a data access page by three different fields. This HTML page is a frameset made up of two data access pages. The first page provides the controls to sort the second page.



MORE INFORMATION
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. The following sections show you how to create an HTML page (Frameset Page) and two data access pages (Header Page and Detail Page) in the sample database Northwind.mdb.

Header Page
The Header page contains three dropdown list controls, six option buttons, and two command buttons that you use to control the sort order of the Detail page. The dropdown list controls allow you to choose which fields to sort by. The option buttons allow you to decide whether those fields are sorted in ascending or descending order. One command button sorts the Detail page and the other command button resets the dropdown lists, option buttons, and the sort order of the detail page.  Open the sample database Northwind.mdb.  Create the following table named tblSort:   Table: tblSort ---  Field Name: SortFld Data Type: Text

Table Properties: tblSort -  PrimaryKey: SortFld   Add the following records to the table:   City CompanyName ContactName Country CustomerID Region   Create the following page named dapSortHeader:   Command button --  ID: cmdSort InnerText: Sort

Command button --  ID: cmdClear InnerText: Clear

Dropdown list -  ID: SortList1 ListRowSource: Table: tblSort ListDisplayField: SortFld ListBoundField: SortFld

Dropdown list --  ID: SortList2 ListRowSource: Table: tblSort ListDisplayField: SortFld ListBoundField: SortFld

Dropdown list --  ID: SortList3 ListRowSource: Table: tblSort ListDisplayField: SortFld ListBoundField: SortFld

Option group --  ID: Frame1 BorderStyle: none

Set the group legend's Visibility property to hidden.

Option button (inside Frame1) --  ID: OptionAsc1

Set the InnerText property of the button's Label to Ascending.

Option button (inside Frame1) --  ID: OptionDsc1

Set the InnerText property of the button's Label to Descending.

Option group --  ID: Frame2 BorderStyle: none Set the group legend's Visibility property to hidden.

Option button (inside Frame2) --  ID: OptionAsc2

Set the InnerText property of the button's Label to Ascending.

Option button (inside Frame2) --  ID: OptionDsc2

Set the InnerText property of the button's Label to Descending.

Option group --  ID: Frame3 BorderStyle: none

Set the group legend's Visibility property to hidden.

Option button (inside Frame3) --  ID: OptionAsc3

Set the InnerText property of the button's Label to Ascending.

Option button (inside Frame3) --  ID: OptionDsc3

Set the InnerText property of the button's Label to Descending.  On the Tools menu, point to Macro, and then click Microsoft Script Editor.</li> On the HTML menu, point to Script Block, and then click Client.</li>  Type the following script: <SCRIPT language=vbscript>

</SCRIPT> </li>  Using the Script Outline, insert the following script for the onClick event of cmdSort: <SCRIPT event=onclick for=cmdSort language=vbscript>

</SCRIPT> </li>  Using the Script Outline, insert the following script for the onClick event of cmdClear: <SCRIPT event=onclick for=cmdClear language=vbscript>

</SCRIPT> </li></ol>

Detail Page
The Detail page is the page that shows the records in the sort order specified by the Header page. <ol>  Create the following page named dapSortDetail based on the Customers table: <pre class="fixed_text">  Text box -  ID: CustomerID ControlSource: CustomerID

Text box --  ID: CompanyName ControlSource: CompanyName

Text box --  ID: ContactName ControlSource: ContactName

Text box ---  ID: City ControlSource: City

Text box --  ID: Country ControlSource: Country

Text box -  ID: Region ControlSource: Region </li> On the Page Design toolbar, click Sorting and Grouping.</li> Under Group Record Source, click Customers, and then set the CaptionSection property to Yes. Set the DataPageSize property to 10.</li> Move the labels to the Caption section.</li> Arrange all the text boxes and labels in a line near the top of the appropriate section. Decrease the size of section to remove extra blank space.</li></ol>

Frameset Page
The Frameset page is the HTML page that loads the two data access pages. <ol>  Using an HTML or text editor, create the following HTML page and save it as SortFrame.htm in the same folder as the two data access pages: <HTML> <FRAMESET ROWS="18%, *"> <FRAME ID="hdr" SRC="dapSortHeader.htm"> <FRAME ID="dtl" SRC="dapSortDetail.htm"> </FRAMESET> </HTML> </li> Use Microsoft Internet Explorer to open the SortFrame.htm page.</li></ol>

Additional query words: sorted sorting

Keywords: kbhowto kbdap kbdapscript KB234986

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.