本文介绍了用于计算订单总额的DSum / Sum的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为餐馆创建食品订购系统。


我尝试过使用DSum和Sum函数来计算订单的总成本。总成本是tblOrder表单上的文本框(以及tblOrder中的字段),并且膳食列表及其成本在tblOrderDetail子表单中(此表单中的列来自两个表 - tblOrderDetails和tblItems)。


我一直把DSum / Sum放在控制权属性中。使用表达式构建器我尝试过:

DSum([tblOrderDetail Subform] .Form![Cost],[tblOrderDetail Subform] .Form)

结果:#error

= DSum([Cost],[tblOrder])结果:#name?

= DSum(" Cost"," tblOrder")结果:#error

= DSum(" [[Cost]",[tblOrder]")结果:#error


有时候我会得到 #name?错误,我可以通过使用更冗长的描述(不确定'是正确的单词)来解决,尽管所有的互联网示例只使用引号中的一个单词,或者我得到 #error 我根本无法解决。


我没有指定标准,因为我希望它计算该订单中所有项目的成本


表和表单都被称为tblOrder因为我没有更改Access在窗口中选择的名称wizzard


我正在使用Access 2000

I am trying to create a food order system for a restaurant.

I have tried using both the DSum and Sum functions to calculate the total cost of an order. The total cost is a textbox on the form tblOrder (and a field in tblOrder) and the list of meals along with their costs are in the tblOrderDetail Subform (the columns in this form come fromt two tables - tblOrderDetails and tblItems).

I have been putting the DSum / Sum in the control soure property. With the expression builder I have tried:
DSum ( [tblOrderDetail Subform].Form![Cost] , [tblOrderDetail Subform].Form )
result: #error
=DSum([Cost],[tblOrder]) result: #name?
=DSum("Cost","tblOrder") result: #error
=DSum("[Cost]","[tblOrder]") result: #error

Sometimes I get #name? error, which i can solve by using a more lengthy description (not sure that''s the right word) though all the internet examples only use one word in quotation marks, or i get #error which i can''t solve at all.

I haven''t specified a criteria as I wanted it to calculate the cost for all the items in that order

Both the table and the form are called tblOrder becasue I didnt change the name Access chose in the form wizzard

I am using Access 2000

推荐答案


展开 | 选择 | Wrap | 行号


展开 | 选择 | Wrap | 行号


这篇关于用于计算订单总额的DSum / Sum的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 05:38