使用DLookUp将一个记录中的字段除以下一个字段中的相同字段 [英] Using DLookUp to divide a field in one record by the same field in the next

查看:56
本文介绍了使用DLookUp将一个记录中的字段除以下一个字段中的相同字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。我是新手,对构建数据库还不错。在设计这个问题时学到了很多东西,但我最后一个表达方式仍然坚持。我正在尝试创建一个计算控件。表单名为Complete_Worksheet。它显示以下字段:


ID

标准

结果测量

分子/分母< br $>
CalcValue


我想要做的是除以CalcValue的值。记录中的字段,由下一条记录中相同字段的值组成。我一直在使用的表达是:


= DLookUp(" [CalcValue]"," Complete_Worksheet"," [ID] ="& " [[ID] -1" /" [ID] =")

ID字段也是源查询的关键。


当我查看表单时,计算字段显示#Error。不考虑CalcValue字段的值。


当我在Visual Basic上运行表达式时立即窗口,我收到错误消息编译错误:预期:行号或标签或声明或声明结束


我感谢您为此工作提供的任何帮助。

解决方案

试试这个...

展开 | 选择 | 换行 | 行号


< blockquote>这是表单的名称。


我尝试了你建议的脚本并在立即窗口中收到了相同的错误信息。


仍然没有在表格上工作。


这是表格的名称。


我尝试了你建议的脚本并收到了同样的错误信息即时窗口。


还没有在表格上工作。



这是因为您需要DLookup的表或查询名称。它将表格或查询分散在表单后面,而不是表单本身。


Mary


Hi all. I''m new here and fairly new to building databases. Learned a lot in designing this one, but I am stuck on this one last expression. I''m trying to create a calculated control. The form is named "Complete_Worksheet". It displays the following fields:

ID
Standard
Outcome Measure
Numerator/Denominator
CalcValue

What I am trying to do is divide the value for the "CalcValue" field in a record by the value for the same field in the next record. The expression I''ve been working with is:

=DLookUp("[CalcValue]",,"Complete_Worksheet","[ID]="&"[ID]-1"/"[ID]=")

The ID field is also the key for the source query.

When I view the form, the calculated field shows "#Error" reagardless of the values for the CalcValue field.

When I run the expression on the Visual Basic "Immediate" window, I get the error message "Compile Error: Expected: line number or label or statement or end of statement"

I appreciate any help you can give in getting this working.

解决方案

Try this ...

Expand|Select|Wrap|Line Numbers


That is the form''s name.

I tried your suggested script and received the same error message in the Immediate window.

Still doesn''t work on the form either.


That is the form''s name.

I tried your suggested script and received the same error message in the Immediate window.

Still doesn''t work on the form either.

That''s because you need the table or query name for the DLookup. It seaches the table or query behind the form not the form itself.

Mary


这篇关于使用DLookUp将一个记录中的字段除以下一个字段中的相同字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆