View Single Post
  #11  
Old May 20th, 2010, 06:39 PM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Sum & Count on Form.

On Thu, 20 May 2010 09:41:01 -0700, Chiki
wrote:

I did not get u..How could i use the Control source of Employee Name as EMP Id.

I could not understand the syntax also.


Please open the form in design view.

Select the Employees combo box.

View its Properties.

Post the following properties to a message he

- Rowsource (where the combo box gets its information) - post the SQL view if
it is a query
- Control Source (where it puts the data when you select a row)
- Bound Column (which field from the rowsource it stores in the control
source)

The syntax of DSum is that it takes three text strings as arguments. The first
text string is the field that it sums; the second is the name of the table or
query containing the field; the third is an optional criterion specifying
which records to sum. So

=DSum("[Amount Earned]", "[EMP]", "[Emp id] = " & [Employee Name])

means look in the table EMP; select those records where the [Emp id] field is
equal to the value contained in the form control named [Employee name] - which
I'm hoping is the employee ID; and when you find those records, sum up the
numbers in the field named [Amount Earned] and return that sum as the result
of the function.
--

John W. Vinson [MVP]