Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dsum help required 2

Status
Not open for further replies.

Moss100

Technical User
Aug 10, 2004
579
0
16
GB
Hello,

I am trying to get a running total in my query

Below I am summing the CREDIT field from the table TRANSACTION and including records that are equal or less than the ID field.

This works fine.

RunningSumCredit: DSum("[Credit]","[Transaction]","[ID]<=" & [ID])


I would like to restrict the sum to records that contain the words "Rent Paid" in the NOTES field

I have tried the following, but its not working - please could someone show me where I am wrong?

RunningSumCredit: DSum("[Credit]","[Transaction]","[ID]<=" & [ID] AND ([notes]="RentPaid"))

Many thanks Mark
 
Try something like:
[tt]
RunningSumCredit: DSum("Credit","Transaction.ID <= " & ID & " AND Transaction.notes = "RentPaid")
[/tt]

Have fun.

---- Andy

There is a great need for a sarcasm font.
 
RentPaid should be quotes within quotes so use either:

Code:
RunningSumCredit: DSum("[Credit]","[Transaction]","[ID]<=" & [ID] & " AND [notes]='RentPaid'")

or

Code:
RunningSumCredit: DSum("[Credit]","[Transaction]","[ID]<=" & [ID] & " AND [notes]=""RentPaid""")

Duane
Vevey, Switzerland
Hook'D on Access
MS Access MVP 2001-2016
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top