Tutorials to .com

Tutorials to .com » Software » Vfp » In VFP print statements to achieve the specified number of records per page

In VFP print statements to achieve the specified number of records per page

Print View , by: iSee ,Total views: 26 ,Word Count: 1662 ,Date: Sat, 18 Apr 2009 Time: 7:38 PM

VFP in various enterprises and institutions in a wide range of applications, I use it to develop the use of the unit testing of components of information management systems, it is now day-to-day work of the unit an indispensable management tool. Many of the development of their own experiences, but most want to talk about that in statements to achieve the specified number of records per page to print this issue.

Method a

In the vfp report generator, the preparation of statements, by adjusting the headband and the statements on page footers with a high degree of method to control the page to print the record data, which is a relatively simple, easy to implement method. However, due to different computers in different sizes of paper like the default, or the same matrix in the margin settings are not the same page and make the records per page to print a few changes. This is fixed, and fixed the printer users, the paper is concerned, there is no problem, but if the software running on multiple computers or extended to a wider range of users, it is necessary to consider different printers and paper problems. At this point can be used the following method described in Methods II and III to achieve.

In addition, there are many user requirements as the number of records in the table rather than the entire number of pages in the last page in a form to fill empty statements, and only in the following can be achieved in two ways.

Method II

The following statements assume that the process used in the table entitled TEMP.DBF

In the report designer in:

1, the statements in front of the print field to delete all the alias prefix.

2, the statements of the original data table environment environment removed from the data.

3, the data in the statements in Init environment Add the following code:

*-- DetailNum is in the details with the number of records to be printed can be entered here by the need to modify

local DetailNum

DetailNum = 17

*-- The following SQL statement to delete records to eliminate the impact of the sub-field data and the appropriate sequencing

SELECT * FROM TempsintosTABLE TMP1swheresNOT DELETED () & & & & sgroupsby sort conditions

SELECT int ((recno () -1) / DetailNum) as GroupCount, *;

FROM Tmp1;

sintosCURSOR Temp2


*-- In order to maintain a clean environment, just delete the establishment of the interim table

delete file TMP1.dbf

if file ( "TMP1.fpt")

delete file TMP1.fpt


*-- Note: You can set the code above DetailNum the value of each page you want to print a record of statements of a few.

*-- You can in the first sentence of SQL Select in accordance with the need to set up your sgroupsby clause to sort the data.

4, an increase in the statements and set up a sub-sub-expression for GroupCount (that is, above the second SQL Select statement in the first column), and select the group to start a new check box.

5, operation of your statements.

6, Finally, is this: in the statements should be set up to run the correct path to VFP statements can be found by using the table.

Method III

In this method, the definition of a global variable tobePrint, the value of the variable is a record of each page to print a few, if there is no definition of the variables, then use the default 15 records per page to print.

1, temp.dbf statements added to the data environment.

2, the data will be temp.dbf environment BufferModeOverride property is set to 5.

3, attributes Destroy the environment in the data to write events:

= tablerevert (. t.)

4, data on environmental properties in the Init event to write:

if vartype (tobePrint) = "U" & & & & if not the definition of global variables, where the definition of its default value is 15

Public tobePrint

tobePrint = 15


*-- The following code is to be printed in order to be satisfied with a number of records, the print blank lines to fill the whole page statements

do while reccount ( "temp")% tobePrint <> 0

append blank


5, in the statements of the two statements in the new variables such as: nCount, nGroup, the calculation of variable nCount select Options group count in the nGroup variable value to be stored in writing:

iif (nCount <> 0 and nCount% tobePrint = 0, nGroup +1, nGroup)

6, in statements to add and set up a sub-sub-expression for nGroup, and select the group to start a new check box.

7, run the following code statements:

use temp

*-- Repeat the definition of variables in order to avoid errors in the definition of global variables before the first release of it

release tobeprint

*-- The definition of global variables, the variables in the preservation of the records per page to print a few

public tobeprint

*-- Set 10 records per page to print

tobeprint = 10

*-- Print our statements

report form temp preview

Method II and method of the similarities and differences between the three

Both are using the method of data subgroup to achieve "the specified number of records per page to print" to the table to add records to the realization of space, "the number of records in the table rather than the entire number of pages in the last page of the form in the space statements to fill up. "

The difference lies between the two: Method 2 is to use temporary table to solve the problem, the data packet of information written on the temporary table, the method is the use of statements of the three variables to solve the problem of packet, data packet is variable statements to achieve the .

Visual FoxPro Tutorial Articles

Can't Find What You're Looking For?

Rating: Not yet rated


No comments posted.