returned value

  • Thread starter Thread starter PF
  • Start date Start date
P

PF

Hi all,

i am using dcount() and dsum

to display the amount of record and a sum of a field in a database in a
textbox on a form.

i think it is faster to do that with a sql statement, am i right?

if i use a sql statement, is there a way like parameter passing
to return the result in a variable

i want something like

txtSumQty = docmd.runsql strsql

The only way i know to get the result on a sql sum statement is to
open a recordet and then find the value.

i would like a more direct single inline statement

Regards,
Pierre
 
You cannot use a SQL statement directly in the Control Source of a text box.

You could use a query as the Record Source for your form, and use a subquery
to retrieve the related value. This will be much faster than the domain
aggegate functions, but the results will be read-only.

If performance is the issue, you can write your own functions to replace
DLookup() etc. They will be faster, but not as fast as the subquery. Example
at:
http://members.iinet.net.au/~allenbrowne/ser-42.html
 
Back
Top