0
votes

SMS TABLE

How do I write a code to sum up the SMS cost per message for a specific course ID Eg. C0001 = $0.50 + $0.10 + $0.20 .... I've tried creating a label and changing the control source to

=DSum("SMS COST PER MESSAGE","SMS TABLE","COURSE ID = C0001") 
=DSum("SMS COST PER MESSAGE","SMS TABLE","COURSE ID = "C0001"") 

Error is The expression you have entered contains invalid syntax You may have entered an operand without an operator

but to no avail Thank you

1

1 Answers

0
votes

Field is text type so use apostrophe delimiters. Also, spaces in field and table names so use []. Advise not to use spaces or punctuation/special characters (underscore only exception) in names.

=DSum("[SMS COST PER MESSAGE]","[SMS TABLE]","[COURSE ID] = 'C0001'")

Could use doubled quote marks but I find apostrophes easier to read. You judge:

=DSum("[SMS COST PER MESSAGE]","[SMS TABLE]","[COURSE ID] = ""C0001""")