简体   繁体   English

“ #名称? ”使用DLookup访问时发生错误

[英]“ #Name? ” error in access using DLookup

在此处输入图片说明

What I am trying to do is to have a value("Element" which is a primary key) from my Elements table be inserted into the time textbox based on the result from the previous combox . 我想做的是根据前一个combox的结果,将Elements表中的value(“ Element”为主键)插入到时间文本框中

Is this the write snytax to achieve this ?? 这是写snytax来实现这一目标吗?

=DLookUp("[Time]","[Elements]","[Element]=" & [Forms]![1 Cut Wire and Cable Only]![Element])

I suspect that there is a mismatch between the name of your combo box control and name you use in your DLookup. 我怀疑您的组合框控件的名称和您在DLookup中使用的名称之间不匹配。 Try changing the combo box control's Name to cbxElement and then using 尝试将组合框控件的名称更改为cbxElement ,然后使用

=DLookUp("[Time]","[Elements]","[Element]=""" & [cbxElement] & """")

for the Control Source of the text box. 文本框的“控制源”。 Note that it is usually a good idea to use a prefix like "cbx" for combo boxes, "txt" for text boxes, etc., because 请注意,通常最好将前缀“ cbx”用于组合框,将“ txt”用于文本框等,因为

  1. it makes them easier to find in an IntelliSense list, and 它使它们更容易在IntelliSense列表中找到,并且

  2. it avoids potential conflicts when the name of a control is identical to the name of a field in the underlying record source. 控件的名称与基础记录源中的字段的名称相同时,它避免了潜在的冲突。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM