KB-58769: Adding/subtracting the first and last records returned by a query.

Question:

How can I filter the first and last records in a query, and then add them and/or subtract one of the other?

Solution:

Via GetADORecordset method, you can retrieve both the first and the last record of the query, and then either add or subtract the returned values.

The commands MoveFirst and MoveLast allow you to access respectively the first and the last record in the query.

Example:

set RS = Screen.Item("E3Browser").Item("Query1").GetADORecordset()
RS.MoveFirst
Field = RS.Fields("Field").Value
RS.MoveLast
Field2 = RS.Fields("Field").Value

Then, you will just need to use the fields “Field” e “Field2” to add and/or subtract values.

Print Friendly, PDF & Email

Este artigo foi útil? Was this helpful?

Classificação média - Average rating 0 / 5. Count: 0

Leave a Reply

Your email address will not be published.Required fields are marked *