DMax&的问题使用DLookup [英] Problem with DMax & DLookup

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

问题描述

Howdy Errrrbody,


我是新来的!我有几个问题似乎无法得到解答,也许你们都可以帮忙。


我正在写一个访问程序(我第一次习惯了。 Net + Sql Server)我试图从表和存储中选择最大ID,这样我就可以在引用的表中使用该ID,这是我尝试过的:


intReturnGoodsAuthorizationID = DMax ([intReturnGoodsAuthorizationID],[TReturnGoodsAuthorizations])

这应该返回10(最高ID)但它返回0



intReturnGoodsAuthorizationMaxID = DLookup(" [intReturnGoodsAuthorizationID]"" [MaxRGA]")

这会产生2001运行时错误。

这是查询,不确定理论上发生了什么,如果DLookup不起作用,DMax应该返回0以外的东西,而不是我的数据库中的ID。这是在Access 2003中。


感谢期待贡献!

AricC

Howdy Errrrbody,

I''m new here! I have a few questions that I can''t seem to get answered, maybe you all can help.

I am writing an access program ( first time I''m accustomed to .Net + Sql Server ) I am trying to select the Max ID from a table and store so I can use that ID in a referenced table here is what I have tried:

intReturnGoodsAuthorizationID = DMax("[intReturnGoodsAuthorizationID]", "[TReturnGoodsAuthorizations]")
This should return 10 (the highest ID) but it returns 0



intReturnGoodsAuthorizationMaxID = DLookup("[intReturnGoodsAuthorizationID]", "[MaxRGA]")
This produces a 2001 runtime error.

Here is the query, not sure what''s going on in theory if the DLookup doesn''t work the DMax should return something other than 0 which is not an ID in my db. This is in Access 2003.

Thanks looking forward to contributing!
AricC

推荐答案

你不会说你想要做到这一点。你不能在表中的默认值中执行它,如果这就是你想要做的事情。


你不能将它的价值归还给自己。


如果这是一个查询:

SELECT Max([intReturnGoodsAuthorizationID])AS MaxID FROM [TReturnGoodsAuthorizations];


代码:


声明一个局部变量。

You don''t say where you are trying to do this. You can''t do it in the default value in the table if thats what you are trying to do.

You can''t return its value to itself.

If this was a query:

SELECT Max([intReturnGoodsAuthorizationID]) AS MaxID FROM[TReturnGoodsAuthorizations];

In code:

declare a local variable.

展开 | 选择 | Wrap | 行号



你不知道你在哪里尝试这样做。如果你正在尝试做什么,你不能在表中的默认值中执行此操作。
You don''t say where you are trying to do this. You can''t do it in the default value in the table if thats what you are trying to do.



我在提交按钮点击事件中这样做。

I''m doing this in a Submit buttons click event.


你不能将它的价值归还给自己。
You can''t return its value to itself.



Jeez周五是我回家的时候了!


谢谢!

AricC

Jeez long Friday it''s time for me to go home!

Thanks!
AricC


我把它拿回来,你可以将它返回到引用它的表单上的字段控件。

只是想一想,如果这是一个主要的关键它不会让你返回10你必须返回11.

I take it back, you can return it to a field control on your form referencing it.
Just a thought, if this is a primary key it won''t let you return 10 you have to return 11.

展开 | 选择 | Wrap | 行号


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

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