我如何使用DLookUp? [英] How do I use DLookUp?

查看:63
本文介绍了我如何使用DLookUp?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,


我一直试图玩这个好几天了,不能让它正常工作。我正在尝试使用DLookUp函数(在我的表单上),这样我就可以键入一个项目,例如ID号,它可以输入2个单独的文本或组合框,它将在一个框中显示一个名称,在另一个框中显示一个地址。我一直在尝试使用DLookUp功能,但我似乎无法让它工作。


我不明白,如果我需要把它放在每个盒子里,或只有一个盒子,或只在表格上?


任何帮助都会很棒!


这是我到目前为止所拥有的,

Hello,

I have been trying to play with this for several days now and can not get it to work right. I am trying to use the DLookUp function (on my form) so that I can type in one item such as an ID number and it 2 seperate text or combo boxes it will display a name in one box and in the other box an address. I keep trying to use the DLookUp function but I cant seem to get it to work.

I dont understand if I need to put it in every single box, or only one box, or only on the form??

Any help would be great!

Here is what I have so far,

< span class =codeLinkonclick =Blur(this,this.parentNode.parentNode,getChildren(this),true);>展开 | 选择 | Wrap | 行号

推荐答案

我很害怕我无法确切地知道你要求的东西,所以我会解释我能做什么,看看这对你有帮助。如果没有,我们至少可以从那里开始。


首先,所有参数都是字符串。

字段是一个字符串参数使用其中的字段名称或相对于域的表达式,解析为值。

EG" [StudentID]",[SalesVal] - [CostVal] "," [FirstName]& ''''& [LastName]"。

是一个字符串参数,它是表或查询的名称。它不适用于SQL字符串。

EG" [tblStudent]",[qryYearlySales]"

条件,在使用时,是一个字符串参数,它指定条件,就像在SQL WHERE子句中使用一样,但没有单词WHERE。

EG" [StudentID] = 32667183"," [LastName] =''Brown''"," [StudentID] = 32667183或[LastName] =''Brown''"

标准 of Combo8"从某种程度上说是不对的。你真正想要的是不清楚,但你肯定希望将Me.Combo8的价值包含在某个地方。 " Combo8"并没有解决任何问题,因为字符串最终与Combo8完全相同。
I''m afraid I''m unable to work out exactly what you''re asking for, so I will explain what I can and see if that helps you. If not, we can at least proceed from there.

Firstly, all parameters are strings.

Field is a string parameter with the name of a field in it, or an expression, relative to the Domain, that resolves to a value.
EG "[StudentID]", "[SalesVal]-[CostVal]", "[FirstName] & '' '' & [LastName]".

Domain is a string parameter that is the name of a table or query. It will not work with a SQL string.
EG "[tblStudent]", "[qryYearlySales]"

Criteria, when used, is a string parameter that specifies criteria just as you would use in a SQL WHERE clause, but without the word "WHERE".
EG "[StudentID]=32667183", "[LastName]=''Brown''", "[StudentID]=32667183 OR [LastName]=''Brown''"

Criteria of "Combo8" is not right by a way. What you actually want is unclear, but you''d certainly want the value of Me.Combo8 to be included somewhere. "Combo8" doesn''t resolve to anything as the string ends up exactly as "Combo8".


你好NeoPa,


我感谢你回复! :D


好​​的,所以使用DLookUp时。我有Field,Domain和Criteria。我想我明白了。您可以使用场部分来查看框要返回或显示的内容吗?因此,如果我希望该框显示表中的名称,我将使用列标题First_Name,那么域将是它的类似Name_List的表,那么标准是如何引用它就像NameID = 5。


但是从这个看起来的方式我必须为列表中的每个记录创建一个设置。我怎么能以更一般的方式做到这一点。我可以让它更开放,例如,


字段是ID号(但它可以是任何Id号),然后域是NumberTable(我没有真正改变)然后,标准将由需要打开的身份证号码提取。这样您输入一些ID号,它会在ID号表中查找,然后提取匹配的名称以与ID号一起使用。


另外我想要做的就是这样你就可以在一个方框中输入身份证号码,它会在一个方框中提取名字,然后输入一个地址在另一个盒子里。你只是保持第一部分与Field和Domain相同,但只是添加Criteria才能做到这一点?


再次感谢您的帮助。希望我能以正确的方式提出这个问题。
Hi NeoPa,

I appreciate you replying back! :D

Ok so when using the DLookUp. I have the Field, Domain, and Criteria. I think I understand that much. You would use the Field part for what you want the box to return or display right? So if I want the box to display a Name from a table I would use the the Column heading "First_Name", then the Domain would be what table its in like "Name_List", then the criteria is How to reference to it like "NameID = 5".

But from the way this looks I would have to create a setting for every record in list. How would I do it in a more general way. Where i can leave it more open such as,

The Field is ID Number (but it could be any Id number), then The Domain is NumberTable(which Im does not really change), Then the Criteria will be what is pulled up by the ID number which would need to be open as well. This way you type in some ID number, it looks in the ID number Table and then pulls up a matching Name to go along with the ID number.

Also What I want to be able to do it make is so you can type in the ID number in one box and it will pull up the name in one box and then and an address in another box. Do you just keep the first part the same with the Field and Domain but just add on Criteria in order to do this??

Thanks again for the help. Hope im asking this the right way.


让我们一步一步。我不容易理解你所有的问题是什么,所以让我们尽可能保持简单,我们可以取得良好的进展我很有信心。


让''首先:
@slenish


您的记录集中实际上有多个字段是[ID号]的变体吗?或者你只是说这个领域可能有很多价值?如果是后者那么字段的值应该非常简单。 [身份证号码]。数据的变化 - 记录要选择的IE - 由Criteria参数处理。如果它是前者而不是你需要解释的情况,因为它目前尚不清楚。
Let''s take this one step at a time. I don''t easily understand what all your problems are so let''s keep it as simple as possible and we can make good progress I''m sure.

Let''s start with :
@slenish
Do you actually have many fields in your recordset that are variants of [ID Number]? or are you just saying there may be many values in this field? If the latter then the value for field should be very simple. "[ID Number]". Variations of the data - IE which record to select - are handled by the Criteria parameter. If it''s the former than you will need to explain the situation as it''s currently not clear.


这篇关于我如何使用DLookUp?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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