Dlookup问题 [英] Dlookup issues

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

问题描述

为什么adp文件中的以下代码会产生关于列的消息(无论InstCode产生什么) 未找到? 希望能够从tblInstitution中选择InstName,其中InstCode = Instcode的值。

Why does the following code in an adp file yield a message about column (whatever InstCode yields) not being found?  Hoping to have something along the lines of selecting InstName from tblInstitution where InstCode = the value of Instcode.

        InstCode =使用DLookup(QUOT;花园及QUOT;," tblthetable"," [苹果] ="&安培; CLng函数(InCode))

      &NBSP ; gen_GetName =使用DLookup(QUOT; InstName"," tblInstitution"," InstCode = QUOT;&安培; InstCode)

        InstCode = DLookup("Garden", "tblthetable", "[Apple]=" & CLng(InCode))
        gen_GetName = DLookup("InstName", "tblInstitution", "InstCode= " & InstCode)

 

推荐答案

嗨!

DLookup从数据库中的记录返回一个值。 这里有更详细的描述:
http://support.microsoft.com/kb/208786

DLookup returns a value from a record in a database.  It is described in more detail here: http://support.microsoft.com/kb/208786

您的示例与此查询大致相同:

Your example is the roughly the same as this query:

Select Garden
From tblthetable
where [apple] = @InCode

将Garden字段的值返回到变量InstCode中。 该函数的第三个参数是WHERE子句(没有WHERE关键字),在您的示例中,通过连接字符串组成。

The value of the Garden field is returned into the variable InstCode.  The third parameter of the function is the WHERE clause (without the WHERE keyword), and is composed, in your example, by concatenating string.

如果您找到列未找到错误,这一定是因为Garden或Apple专栏不存在。

If you are getting a column not found error, it must be because the Garden or the Apple column does not exist.

希望这会有所帮助!

Karl

 

 

 

 

 


这篇关于Dlookup问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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