Multiple DLookup Criteria

L

Levans digital

bfLeaveDue = DSum("[LeaveDue]", "qryVacation", "VacationID <= " &
[VacationID] )

The above expression works as it supposed to but the I would like to narrow
down the results by adding in a second criteria. thats looks like this.

bfLeaveDue = DSum("[LeaveDue]", "qryVacation", "EmploymentID = " &
[EmploymentID] )

How can I join these togather? I have tried several ways, honestly I dont
know if its even possible.

Basically the completed expression should sum the value of the "leaveDue"
field based on all the "vacationID" that is less than or equal to the current
"vacationID" for the current "EmployeeID. Initially the "bfLeaveDue" will be
populated on the click of a button.

Thanks
 
K

Kevin B

Perhaps the following will work for you:

=DSum("[LeaveDue]","qryVacation","[EmploymentID]= " & [EmploymentID] & " And
[VactionID]<=" & [VactionID])
 
L

Levans digital

Thanks for the reply.
However when the expression is run on the click event of a button on the
form I get "Microsoft access cannot find the field "!"........

What do you think

Kevin B said:
Perhaps the following will work for you:

=DSum("[LeaveDue]","qryVacation","[EmploymentID]= " & [EmploymentID] & " And
[VactionID]<=" & [VactionID])
--
Kevin Backmann


Levans digital said:
bfLeaveDue = DSum("[LeaveDue]", "qryVacation", "VacationID <= " &
[VacationID] )

The above expression works as it supposed to but the I would like to narrow
down the results by adding in a second criteria. thats looks like this.

bfLeaveDue = DSum("[LeaveDue]", "qryVacation", "EmploymentID = " &
[EmploymentID] )

How can I join these togather? I have tried several ways, honestly I dont
know if its even possible.

Basically the completed expression should sum the value of the "leaveDue"
field based on all the "vacationID" that is less than or equal to the current
"vacationID" for the current "EmployeeID. Initially the "bfLeaveDue" will be
populated on the click of a button.

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top