行号查询 - PK未知 [英] Row Number query - PK unknown
问题描述
我已经在cdma帖子的集体知识库中钓鱼了
一段时间来解决这个问题 - 但没有快乐。毋庸置疑,
我也试图弄明白这一点。
基本上,我需要再次运行一个查询表格可以识别某个值是什么
行。这很容易 - 除了它要运行
而不是一些不确定的表或不确定的主键。
这不是表格不是索引,大多数是 - 但我正在尝试
构建一个通用的sql构建函数,它可以对任何表运行,因为它是验证过程的一部分。
大大简化示例:
表
姓名年龄
----- -
Bob 6
Ann 10
Tim
Sam 5
查询结果:
记录无字段问题
--------- ----- -------
3"年龄"空值
这比我正在做的大大简化,我没有问题
带有数据验证的东西(由单独的有效性规范驱动)
表) - 实际上它涉及交叉检查表值等 - 但是
问题依然存在:
当你不知道主键是什么,你怎么得到一个记录
的数字?考虑到其中一些表格的宽度以及对于
这一事实,有些人不要求记录不同,分组就出来了:(
.. ..可能不可能
I''ve been fishing in the collective knowledge pool of cdma posts gone
by for a solution to this for a while - but no joy. Needless to say,
I''ve also done my own head in trying to figure this out.
Basically, I need to run a query agains a table that can identify what
row a value is on. This would be easy enough - except it''s to be run
againt a number of indeterminate tables or indeterminate primary keys.
It''s not that the tables arent indexed, most are - but i''m trying to
build a generic sql building function that can run against any table as
part of a verification process.
Greatly Simplified Example:
Table
Name Age
---- ---
Bob 6
Ann 10
Tim
Sam 5
Query Result:
Record No Field Problem
--------- ----- -------
3 "Age" Null Value
This is greatly simplified from what i''m doing and I have no problems
with the data validation stuff (driven from a seperate validity spec
table) - In reality it involves cross checking table vales etc - but
the problem remains the same:
When you dont know what the primary key is, how do you get a record
number? Given the width of some of these tables and the fact that for
some have no requirement for records to be distinct, grouping is out :(
....probably not possible
推荐答案
当然有可能 - 一旦我点击帖子,答案来了
me ...对不起。
我使用的函数增加并返回一个模块变量,并且
使用任何随机字段调用它(以防止喷射缓存答案) -
来自表格旁边的子查询。
然后重置每次查询之前,模块变量为0。
.... duh !!!
of course it''s possible - as soon as i clicked post, the answer came to
me ...sorry about that.
I use a function which increments and returns a modular variable, and
call it using any random field (to prevent jet caching the answer) -
from a sub query alongside * from the table.
Then just reset the modular variable to 0 before every query call.
....duh!!!
Bill ,正如您所知,有一个简单的方法就是访问
查询。
您能否在数据表视图中使用表单?而不是查询?如果是这样,
有一个简单的解决方案:只需添加一个文本bo x与ControlSource:
= [表格]。[CurrentRecord]
-
Allen Browne - 微软MVP。西澳大利亚州珀斯。
访问用户提示 - http:// allenbrowne.com/tips.html
回复群组,而不是mvps dot org的allenbrowne。
" BillCo" < co ********** @ gmail.comwrote in message
news:11 ******************** *@h48g2000cwc.googlegro ups.com ...
Bill, as you already know, there''s not a simple way to do that is Access
queries.
Could you live with a form in datasheet view instead of a query? If so,
there is a dead-simple solution: just add a text box with ControlSource of:
=[Form].[CurrentRecord]
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"BillCo" <co**********@gmail.comwrote in message
news:11*********************@h48g2000cwc.googlegro ups.com...
我已经在cdma帖子的集体知识库中钓鱼了
通过一段时间来解决这个问题 - 但没有快乐。毋庸置疑,
我也试图弄明白这一点。
基本上,我需要再次运行一个查询表格可以识别某个值是什么
行。这很容易 - 除了它要运行
而不是一些不确定的表或不确定的主键。
这不是表格不是索引,大多数是 - 但我正在尝试
构建一个通用的sql构建函数,它可以对任何表运行,因为它是验证过程的一部分。
大大简化示例:
表
姓名年龄
----- -
Bob 6
Ann 10
Tim
Sam 5
查询结果:
记录无字段问题
--------- ----- -------
3"年龄"空值
这比我正在做的大大简化,我没有问题
带有数据验证的东西(由单独的有效性规范驱动)
表) - 实际上它涉及交叉检查表值等 - 但是
问题依然存在:
当你不知道主键是什么,你怎么得到一个记录
的数字?考虑到其中一些表格的宽度以及对于
这一事实,有些人不要求记录不同,分组就出来了:(
.. 。可能不可能
I''ve been fishing in the collective knowledge pool of cdma posts gone
by for a solution to this for a while - but no joy. Needless to say,
I''ve also done my own head in trying to figure this out.
Basically, I need to run a query agains a table that can identify what
row a value is on. This would be easy enough - except it''s to be run
againt a number of indeterminate tables or indeterminate primary keys.
It''s not that the tables arent indexed, most are - but i''m trying to
build a generic sql building function that can run against any table as
part of a verification process.
Greatly Simplified Example:
Table
Name Age
---- ---
Bob 6
Ann 10
Tim
Sam 5
Query Result:
Record No Field Problem
--------- ----- -------
3 "Age" Null Value
This is greatly simplified from what i''m doing and I have no problems
with the data validation stuff (driven from a seperate validity spec
table) - In reality it involves cross checking table vales etc - but
the problem remains the same:
When you dont know what the primary key is, how do you get a record
number? Given the width of some of these tables and the fact that for
some have no requirement for records to be distinct, grouping is out :(
...probably not possible
嗯。这仍然会引起问题,比尔。
如果你有一个相当大的记录集,跳到最后,向后滚动
,检查函数是否按你预期的顺序调用。
-
Allen Browne - 微软MVP。西澳大利亚州珀斯。
访问用户提示 - http://allenbrowne.com/tips.html
回复群组,而不是mvps dot org的allenbrowne。
" BillCo" co ********** @ gmail.comwrote in message
news:11 ******* **************@m73g2000cwd.googlegro ups.com ...
Hmm. That can still cause issues, Bill.
If you have a reasonably large recordset, jump to the end, and scroll
backwards, check to see if the function is called in the order you expected.
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"BillCo" <co**********@gmail.comwrote in message
news:11*********************@m73g2000cwd.googlegro ups.com...
>
当然是的可能 - 一旦我点击帖子,答案就来了
我...对不起。
我使用的函数递增并返回一个模块化变量,并且
使用任何随机字段调用它(以防止喷射缓存答案) -
来自表格旁边的子查询。
然后在每次查询调用之前将模块变量重置为0.
... duh !!!
>
of course it''s possible - as soon as i clicked post, the answer came to
me ...sorry about that.
I use a function which increments and returns a modular variable, and
call it using any random field (to prevent jet caching the answer) -
from a sub query alongside * from the table.
Then just reset the modular variable to 0 before every query call.
...duh!!!
这篇关于行号查询 - PK未知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!