KB-27586: Adding values of a Query field and showing it in a Display.

Question:

How can I add the values of a Query field and show the result in a Display?

Solution:

To do so, you must use SUM() function in the SQL query:

SELECT Sum(Field1) as sum1
FROM DataTable

Then, in a script (for example, in a button’s Click event), you must pass the result to the display using the GetADORecordset() function.

Example:

‘Retrieves a Record set in the Query.
Set RS = Screen.Item(“Query1”).GetADORecordset()
‘Links the Display sum field’s value
Screen.Item(“Text1”).Value = RS.Fields(“sum1”).Value

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 *