Code Help Please (1 Viewer)

thebigman

Registered User.
Local time
Today, 15:19
Joined
Sep 3, 2009
Messages
45
Wonder if someone could help. Im using Office 2010 and trying to get this to work but so far no joy. I,m using it in a text box.
Thanks for any help. Keep getting #error
=DSum("Amount","Ledger","Account='Running Costs'")
 

Gasman

Enthusiastic Amateur
Local time
Today, 15:19
Joined
Sep 21, 2011
Messages
8,752
Code:
=DSum("Amount","Ledger","Account='Running Costs'")

Looks fine to me. Are you using Table lookups for that field?
 

isladogs

CID VIP
Local time
Today, 15:19
Joined
Jan 14, 2017
Messages
15,240
Your syntax looks fine. It should work even if you have null values.
#Error means Access cannot find one or more of the referenced items. Check your field spellings are correct.
 

thebigman

Registered User.
Local time
Today, 15:19
Joined
Sep 3, 2009
Messages
45
Spelling looks OK. I just made a form called trial balance and inserted a text box and used this code. Ledger is table Account field and Amount is money. Running Costs are categories.
 

thebigman

Registered User.
Local time
Today, 15:19
Joined
Sep 3, 2009
Messages
45
I had 1 spelling mistake so now I have a blank box.
 

Gasman

Enthusiastic Amateur
Local time
Today, 15:19
Joined
Sep 21, 2011
Messages
8,752
I did not see any obvious spelling error?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 22:19
Joined
May 7, 2009
Messages
13,691
maybe, rename your textbox to something else.
 

thebigman

Registered User.
Local time
Today, 15:19
Joined
Sep 3, 2009
Messages
45
Double checked and all spelling is OK. Checked field types and renamed text box. Now blank box.
 

thebigman

Registered User.
Local time
Today, 15:19
Joined
Sep 3, 2009
Messages
45
Created a new box with same code but blank box. Strange.
 

Gasman

Enthusiastic Amateur
Local time
Today, 15:19
Joined
Sep 21, 2011
Messages
8,752
So upload enough of the db to get the issue.
You have not answered about lookup fields either?
 

Gasman

Enthusiastic Amateur
Local time
Today, 15:19
Joined
Sep 21, 2011
Messages
8,752
Upload database to forum.?
Just enough of it to get the issue.
Compact and repair, zip and upload if quite large, which really it should not be for this is issue.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 22:19
Joined
May 7, 2009
Messages
13,691
does Account field has lookups?
 

thebigman

Registered User.
Local time
Today, 15:19
Joined
Sep 3, 2009
Messages
45
Ok here is file. Not used lookups either.
 

Attachments

  • Scouts Accounts.accdb
    1.2 MB · Views: 18

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 22:19
Joined
May 7, 2009
Messages
13,691
see form1, you have lookup on account field, returning a numeric String.
 

Attachments

  • Scouts Accounts.accdb
    1.3 MB · Views: 13

Users who are viewing this thread

Top Bottom