DSum on a string

On my entrepreneur module I have a form (Pos input form) which shows the following to the users while capturing data:
(1)      Total cash payable
(2)      Cash received
(3)      Change to be given to the client
(4)      Stock current balance by product selected by user
(5)      Average cost by product selected by user
(6)      Average profit by product selected by user
Now I want also to show the total cash received by each logged user on the same form so that they are able to check their cash collection at any time rather printing a report. I have tried to use Dsum but it keeps on giving me either error or #Name? Below is my Dsum:
Dsum(“ TotalCash”,” tblPosdetaillines”,” [Userloged]= “ &[Userloged])

Please note Userloged is a string, this control is updated in table through the forms before insert event, example:
Me.Userloged = Getuser()

I want also to extend the Dsum to look like below:
Dsum(“ TotalCash”,” tblPosdetaillines”,” [Userloged]= “ &[Userloged]& “ AND [PosDate] =#” &[PosDate]& “ #” )
What I’m trying to do here is to get the current cash balance by user and by date. How best can I do this??

I have also a report for cash collection by userloged ,I have tried to total by user , but it keeps totalling by all users , any idea here . For example I want to see something like below:

22/01/2018   Chris  $20
22/01/2018   Chris  $30
Total                 2       $50

22/01/2018    Peter $15
22/01/2018    Peter $20
Total                 2        $35

Final Total       4        $85        

The above report will help us to quickly check for shortages or overs

Thank in advance


Regards

 

Chris
LVL 3
Hankwembo Christopher,FCCA,FZICA,CIA,MAAT,B.A.ScDirectorAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rgonzo1971Commented:
Hi,

pls try
Dsum("TotalCash","tblPosdetaillines","[Userloged]= '" & [Userloged] & "'"

Open in new window

Regards
0
Gustav BrockCIOCommented:
That would be:

=Dsum("TotalCash","tblPosdetaillines","[Userloged]= '" & [Userloged] & "' AND [PosDate] = #" & Format([PosDate], "yyyy\/mm\/dd") & "#")

Open in new window

Be careful with the spaces.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Printers and Scanners

From novice to tech pro — start learning today.