In Nhãn và kiểm soát thứ tự mà Records sẽ in tôi cần để có thể ứng dụng của tôi có in nhãn cho người sử dụng danh sách khách hàng của tôi. Đôi khi người sử dụng của tôi cần in nhãn dựa trên mã bưu chính, | Print Labels and Control the Order in Which Records Will Be Printed I need to be able to have my application print labels for my user s customer list. Sometimes my user needs to print labels based on the postal code and other times he needs to print labels alphabetically by company name. How do I do this at runtime Technique To accomplish this task you will use the Report Expert to create mailing labels. You then will use code to update the sort order at run-time. Creating the Mailing Labels To create the mailing labels you create a new report and choose Mailing Labels for the type of Expert to use. You then fill in the Data tab which uses Customers for the table and grab the following fields CompanyName ContactName ContactTitle Address Formula @CityRegionPostal and Country. You can see how this will look in Figure . Figure . Fields that will be used in the mailing labels. After clicking Next you are taken to the tab that allows you to choose which type of label you want to use. For this How-To the Address Avery 5160 is used. Everything else on the page is chosen for you see Figure . Figure . You have control over how your labels look. Now you can just click Finish and the final mailing label report is created see Figure . Figure . These appear in nice mailing label format when they re viewed on a form. Controlling the Sort Order at Runtime To control the sort order at runtime you use properties methods and objects of the ReportDocument. Specifically you traverse down the ReportDocument object model looking at the Database object and moving down to the Fields level. You do this first when you re loading up a combo box with fields that are being used in the report. The following lines of code accomplish this For Each dfCurr In 0 .Fields Next dfCurr is a FieldDefinition object which means it is a field .