Solved Substract to values in same row and return value DLOOKUP

mhakim

Member
Local time
Today, 14:46
Joined
Jan 25, 2021
Messages
72
I have one row contains : Name | Debit | Credit
Customer| 5500 | 2000
_____________________________________________________________________________________________________________________________________________

i want to make formula Using Expression Builder by Access Reports

Dlookup

return Net (Amount Debit - Credit)

3500
 
something like this in a controlsource in the detail section

=dlookup("[debit]-[credit]","myTable","[Name]='" & me.Name & "'")

note Name is not a good name for a field or control, it is a reserved word. In this case, Me.Name could refer to a field or control or it could refer to the name of the report

Not sure why you want to do this, normal practice would be to include it in your report recordsource as a subquery not a domain function
 
you can also create a Query:

select [name], [debit], [credit], [debit]-[credit] as net from yourtableName;

create a report based on this query.
 
If the two fields are in the same row, why would you need a domain function to look them up? Since this question is in the Reports section, I'm going to assume the problem is how to sum a calculation. And the answer is -- repeat it.

In the detail line the expression is
=[debit]-[credit]

In the group or footer total, the expression is:
=Sum([debit]-[credit])
 

Users who are viewing this thread

Back
Top Bottom