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