记录集混淆 [英] Recordset confusion

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

问题描述

大家好,


我在最近的一个项目中对记录集产生了一些令人困惑的效果。


我创建了几个记录集,每个记录集都设置了相同数量的记录,以及与索引值相关的


我创建一个表并从每个记录集中添加索引值和值/
反过来,
进入一个临时表,我用它创建一个报告。我使用DAO对象创建了

,它运行正常。我使用迭代,并使用

..movenext命令从记录集中获取下一个值。


然后我将其部署到具有访问权限2002的用户计算机中, (其中引用了dao 3.6

,以及用于应用程序的VB和Access 10对象库)

现在记录集的结果显示的顺序不正确,就好像

记录集的订购方式与它们在

开发者机器上的订购方式不同。

然后我删除了所有的DAO引用对象,发现记录集的所有

然后再次正确排序!


我希望通过明确引用DAO对象,并且<假设在用户机器上引用了库,那么

的结果至少会保持一致吗?

我还有其他因素吗?错过了什么?开发人员和用户

机器都有最新的服务包。


因为我通常使用旧版本进行开发,有时会在以后进行部署

版本的Access,非常重要的是我理解了在b / b
可能会导致部署阶段不一致的因素。


我确定这里有线程主题,如果有人有任何意见,或者

引用相关主题,他们将非常欢迎。

Gerry Abbott



Hi all,

I having some confusing effects with recordsets in a recent project.

I created several recordsets, each set with the same number of records, and
related with an index value.
I create a table and add the index value and a value/s from each recordset
in turn, into a temporary table, which I used to create a report. I created
this with DAO objects, and it worked fine. I use iteration, and the
..movenext command to get the next values from the recordsets.

I then deployed into a users machine with access 2002, (which had dao 3.6
referenced, along with VB for applications, and Access 10 object library)
Now the results of the recordset appeared be in incorrect order, as if the
recordsets were not ordered in the same way as they had been on the
developer machine.
I then then removed the DAO references in all the objects and found that all
the record sets were then sorted correctly again!

I expected that by making an explicit reference to the DAO objects, and
assuming that the library is referenced on the user machine, that the
results would at least be consistent?
Is there another factor which I might have missed? Both developer and user
machines have up to date service packs.

Since I generally develop on older versions and deploy sometimes in later
versions of Access, its very important that I understand the factors which
might lead to inconsistencies at deployment stage.

Im sure there are threads on this topic, and if anyone has any comments, or
references to relevant threads, they would be most welcome.
Gerry Abbott





推荐答案

不,订单不能被认为是一致的。


将表视为桶。你抛出记录,但是他们没有被订购

除非你指定你想要检索它们的订单。如果你没有指定你想要的订单,那么压缩数据库或使用表作为链接表可能会改变检索顺序。

压缩数据库或使用表作为链接表。 (在

练习中,Access倾向于使用主键作为

查询的默认顺序,但报告中可能发生任何事情。)


所以,添加一个自动编号字段,或者一个日期/时间字段或者某些东西,让你

指定你想要的订单。


-

Allen Browne - 微软MVP。西澳大利亚州珀斯。

访问用户提示 - http:// allenbrowne.com/tips.html

回复群组,而不是mvps dot org的allenbrowne。


" Gerry Abbott" < PL **** @ ask.ie>在消息中写道

新闻:Ft ***************** @ news.indigo.ie ...
No, the order cannot be assumed to be consistent.

Think of a table as a bucket. You throw records in, but they are not ordered
unless you specify the order you want to retrieve them. Things like
compacting the database or using the table as a linked table are likely to
change the retrieval order if you do not specify the order you want. (In
practice, Access tends to use the primary key as the default order for
queries, but anything can happen in reports.)

So, add an AutoNumber field, or a date/time field or something that lets you
specify the order you want.

--
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.

"Gerry Abbott" <pl****@ask.ie> wrote in message
news:Ft*****************@news.indigo.ie...
大家好,

我在最近的一个项目中对记录集产生了一些令人困惑的效果。

我创建了几个记录集,每个记录集都有相同数量的记录,
和相关的一个索引值。
我创建一个表,并依次将每个记录集的索引值和值/添加到临时表中,我用它来创建报表。 I
使用DAO对象创建了它,并且它工作正常。我使用迭代,并使用
.movenext命令从记录集中获取下一个值。

然后我将其部署到具有访问权限2002的用户计算机中(其中有dao 3.6
引用,以及用于应用程序的VB和Access 10对象库)
现在记录集的结果显示的顺序不正确,好像
记录集的排序方式与它们的顺序不同
开发人员机器。
然后我删除了所有对象中的DAO引用,发现
所有记录集再次正确排序!

我预计通过明确引用DAO对象,并假设在用户机器上引用库,
结果至少是一致的吗?
还有其他因素吗?可能错过了?开发人员和用户
机器都有最新的服务包。

由于我通常使用旧版本进行开发,有时会在以后的版本的Access中部署,因此我理解它非常重要在部署阶段可能导致不一致的因素。

我确定这个主题有线程,如果有人有任何评论,
或相关线程的引用,他们非常欢迎。
Hi all,

I having some confusing effects with recordsets in a recent project.

I created several recordsets, each set with the same number of records, and related with an index value.
I create a table and add the index value and a value/s from each recordset
in turn, into a temporary table, which I used to create a report. I created this with DAO objects, and it worked fine. I use iteration, and the
.movenext command to get the next values from the recordsets.

I then deployed into a users machine with access 2002, (which had dao 3.6
referenced, along with VB for applications, and Access 10 object library)
Now the results of the recordset appeared be in incorrect order, as if the
recordsets were not ordered in the same way as they had been on the
developer machine.
I then then removed the DAO references in all the objects and found that all the record sets were then sorted correctly again!

I expected that by making an explicit reference to the DAO objects, and
assuming that the library is referenced on the user machine, that the
results would at least be consistent?
Is there another factor which I might have missed? Both developer and user
machines have up to date service packs.

Since I generally develop on older versions and deploy sometimes in later
versions of Access, its very important that I understand the factors which
might lead to inconsistencies at deployment stage.

Im sure there are threads on this topic, and if anyone has any comments, or references to relevant threads, they would be most welcome.



谢谢Allen,


我正在做的是创建一个qryDef参数查询(包括

我的ORDER BY索引)

我设置我的qryDef参数值,

然后我设置我的记录集到qryDef openRecordset对象。


然后我用move语句移动记录集。


这个过程中是否有任何地方记录可以变成un''dedered,

如果是这样的话,

我该怎么办? o关于让它恢复正常。 ?


例子

------------------------ -------------------------------------------------- -

-----------------

set db = CurrentDb

set myQryDef = db.qryDefs(" SELECT * FROM qryDepts ORDER BY qryDepts.deptId")


with myQryDef

.parameter(0)= something

.parameter(1)=其他东西

设置myRecordSet = .OpenRecordSet

以myRecordset结束




.movefirst

for i = 1 to .recordCount

......获取记录值并用

他们..............

.moveNext

next i

结束

------------------------------------------ ----------------------------------

-------- ---------


Gerry Abbott


" Allen Browne" <铝********* @ SeeSig.Invalid>在消息中写道

news:40 *********************** @ per-qv1-newsreader-01.iinet.net。 au ...
Thanks Allen,

What I''m doing is creating a qryDef from a parameter query (which includes
my ORDER BY index)
Im setting my qryDef parameter values,
Then I''m setting my recordset to the qryDef openRecordset object.

Then I''m moving through the recordset with the move statement.

Is there anywhere in this process where the records can become un''ordered,
and if so,
how should I go about getting it back into order. ?


example
----------------------------------------------------------------------------
-----------------
set db = CurrentDb
set myQryDef = db.qryDefs("SELECT * FROM qryDepts ORDER BY qryDepts.deptId")

with myQryDef
.parameter(0) = something
.parameter(1)= something else
Set myRecordSet= .OpenRecordSet
end with

with myRecordset.
.movefirst
for i =1 to .recordCount
......get the record values and do something with
them..............
.moveNext
next i
end with
----------------------------------------------------------------------------
-----------------

Gerry Abbott


"Allen Browne" <Al*********@SeeSig.Invalid> wrote in message
news:40***********************@per-qv1-newsreader-01.iinet.net.au...
不,订单不能被认为是一致的。

将表视为桶。您抛出记录,但它们不是
订购,除非您指定要检索它们的订单。如果您没有指定所需的顺序,那么压缩数据库或将表用作链接表可能会更改检索顺序。 (在实践中,Access倾向于使用主键作为
查询的默认顺序,但报告中可能发生任何事情。)

因此,添加自动编号字段,或者一个日期/时间字段或者让你用b $ b指定你想要的顺序的东西。

-
Allen Browne - 微软MVP。西澳大利亚州珀斯。
访问用户提示 - http://allenbrowne.com/ tips.html
回复群组,而不是在mvps dot org的allenbrowne。

Gerry Abbott < PL **** @ ask.ie>在消息中写道
新闻:Ft ***************** @ news.indigo.ie ...
No, the order cannot be assumed to be consistent.

Think of a table as a bucket. You throw records in, but they are not ordered unless you specify the order you want to retrieve them. Things like
compacting the database or using the table as a linked table are likely to
change the retrieval order if you do not specify the order you want. (In
practice, Access tends to use the primary key as the default order for
queries, but anything can happen in reports.)

So, add an AutoNumber field, or a date/time field or something that lets you specify the order you want.

--
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.

"Gerry Abbott" <pl****@ask.ie> wrote in message
news:Ft*****************@news.indigo.ie...
大家好,

我在最近的一个项目中对记录集产生了一些令人困惑的效果。

我创建了几个记录集,每个记录集都有相同数量的记录,
Hi all,

I having some confusing effects with recordsets in a recent project.

I created several recordsets, each set with the same number of records,


与索引值相关。
我创建一个表并依次将每个
记录集中的索引值和值添加到临时表中,我曾经创建过一份报告。我
related with an index value.
I create a table and add the index value and a value/s from each recordset in turn, into a temporary table, which I used to create a report. I


使用DAO对象创建了


created

,它运行正常。我使用迭代和
.movenext命令从记录集中获取下一个值。

然后我部署到具有访问权限2002的用户计算机(其中有dao
3.6)引用,以及用于应用程序的VB,以及Access 10对象
库)现在记录集的结果显示的顺序不正确,就好像
记录集的排序方式与它们上面的方式不同
开发者机器。
然后我删除了所有对象中的DAO引用,发现
this with DAO objects, and it worked fine. I use iteration, and the
.movenext command to get the next values from the recordsets.

I then deployed into a users machine with access 2002, (which had dao 3.6 referenced, along with VB for applications, and Access 10 object library) Now the results of the recordset appeared be in incorrect order, as if the recordsets were not ordered in the same way as they had been on the
developer machine.
I then then removed the DAO references in all the objects and found that


所有

记录集然后正确排序再次!

我希望通过明确引用DAO对象,并假设在用户机器上引用库,
结果至少是一致吗?
我可能错过了另一个因素吗?开发人员和
用户计算机都有最新的服务包。

由于我通常使用旧版本开发并有时部署在
更高版本的Access中,因此我理解它非常重要可能导致部署阶段不一致的因素


我确定这个主题有线索,如果有人有任何意见,
the record sets were then sorted correctly again!

I expected that by making an explicit reference to the DAO objects, and
assuming that the library is referenced on the user machine, that the
results would at least be consistent?
Is there another factor which I might have missed? Both developer and user machines have up to date service packs.

Since I generally develop on older versions and deploy sometimes in later versions of Access, its very important that I understand the factors which might lead to inconsistencies at deployment stage.

Im sure there are threads on this topic, and if anyone has any comments,


对相关主题的引用,非常欢迎。
references to relevant threads, they would be most welcome.




记录将保留其订单他们是开放的。


报告是另一回事。


-

Allen Browne - 微软MVP。西澳大利亚州珀斯。

访问用户提示 - http:// allenbrowne.com/tips.html

回复群组,而不是mvps dot org的allenbrowne。


" Gerry Abbott" < PL **** @ ask.ie>在消息中写道

新闻:GB ***************** @ news.indigo.ie ...
The records will retain their order while they are open.

The report is a different story.

--
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.

"Gerry Abbott" <pl****@ask.ie> wrote in message
news:GB*****************@news.indigo.ie...
感谢Allen ,

我正在做的是从参数查​​询创建一个qryDef(其中包括我的ORDER BY索引)
我设置我的qryDef参数值,
然后我将我的记录集设置为qryDef openRecordset对象。

然后我用move语句移动记录集。

这个过程中是否有任何地方如果记录可以变得不真实,那么如果是这样的话,
我应该怎么做才能让它恢复正常。 ?


-------------------------------- ------------------------------------------
- - ---------------
设置db = CurrentDb
设置myQryDef = db.qryDefs(" SELECT * FROM qryDepts ORDER BY
qryDepts.deptId" )
with myQryDef
.parameter(0)= something
.parameter(1)=其他东西
设置myRecordSet = .OpenRecordSet
结束

with myRecordset。
.movefirst
for i = 1 to .recordCount
......获取记录值并用
做些什么.... ..........
.moveNext
接下来我结束了
------------------ -------------------------------------------------- ------
- -----------------

Gerry Abbott


" Allen Browne" <铝********* @ SeeSig.Invalid>在消息中写道
新闻:40 *********************** @ per-qv1-newsreader-01.iinet.net.au ...
Thanks Allen,

What I''m doing is creating a qryDef from a parameter query (which includes
my ORDER BY index)
Im setting my qryDef parameter values,
Then I''m setting my recordset to the qryDef openRecordset object.

Then I''m moving through the recordset with the move statement.

Is there anywhere in this process where the records can become un''ordered,
and if so,
how should I go about getting it back into order. ?


example
-------------------------------------------------------------------------- -- -----------------
set db = CurrentDb
set myQryDef = db.qryDefs("SELECT * FROM qryDepts ORDER BY qryDepts.deptId")
with myQryDef
.parameter(0) = something
.parameter(1)= something else
Set myRecordSet= .OpenRecordSet
end with

with myRecordset.
.movefirst
for i =1 to .recordCount
......get the record values and do something with
them..............
.moveNext
next i
end with
-------------------------------------------------------------------------- -- -----------------

Gerry Abbott


"Allen Browne" <Al*********@SeeSig.Invalid> wrote in message
news:40***********************@per-qv1-newsreader-01.iinet.net.au...
不,订单不能被认为是一致的。

将表视为桶。您抛出记录,但它们不是
No, the order cannot be assumed to be consistent.

Think of a table as a bucket. You throw records in, but they are not


有序

除非您指定要检索它们的顺序。像压缩数据库或将表用作链接表这样的事情可能是
unless you specify the order you want to retrieve them. Things like
compacting the database or using the table as a linked table are likely to
如果你没有指定检索顺序,则更改检索顺序订购你想要的。 (在实践中,Access倾向于使用主键作为
查询的默认顺序,但报告中可能发生任何事情。)

因此,添加自动编号字段,或者日期/时间字段或其他东西
change the retrieval order if you do not specify the order you want. (In
practice, Access tends to use the primary key as the default order for
queries, but anything can happen in reports.)

So, add an AutoNumber field, or a date/time field or something that lets


指定你想要的顺序。

-
Allen Browne - 微软MVP。西澳大利亚州珀斯。
访问用户提示 - http://allenbrowne.com/ tips.html
回复群组,而不是在mvps dot org的allenbrowne。

Gerry Abbott < PL **** @ ask.ie>在消息中写道
新闻:Ft ***************** @ news.indigo.ie ...
specify the order you want.

--
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.

"Gerry Abbott" <pl****@ask.ie> wrote in message
news:Ft*****************@news.indigo.ie...
大家好,

我在最近的一个项目中对记录集产生了一些令人困惑的效果。

我创建了几个记录集,每个记录集都有相同数量的
记录,
Hi all,

I having some confusing effects with recordsets in a recent project.

I created several recordsets, each set with the same number of records,
与索引值相关。
我创建一个表并依次将每个记录集中的索引值和值添加到临时表,我用它来创建报告。我
related with an index value.
I create a table and add the index value and a value/s from each recordset in turn, into a temporary table, which I used to create a report. I


使用DAO对象创建了


created

,它运行正常。我使用迭代和
.movenext命令从记录集中获取下一个值。

然后我部署到具有访问权限2002的用户计算机(其中引用了dao 3.6,以及用于应用程序的VB和Access 10对象库)现在记录集的结果显示的顺序不正确,就好像记录集的订购方式不同于
开发人员计算机上的记录集。
然后我删除了所有对象中的DAO引用,并找到
this with DAO objects, and it worked fine. I use iteration, and the
.movenext command to get the next values from the recordsets.

I then deployed into a users machine with access 2002, (which had dao 3.6 referenced, along with VB for applications, and Access 10 object library) Now the results of the recordset appeared be in incorrect order, as if the recordsets were not ordered in the same way as they had been on the
developer machine.
I then then removed the DAO references in all the objects and found


所有

记录集然后再次正确排序!

我预计通过明确引用DAO对象,
the record sets were then sorted correctly again!

I expected that by making an explicit reference to the DAO objects,


并假设在用户机器上引用了库,
结果至少是一致的吗?
有没有我可能错过的另一个因素?开发人员和

and assuming that the library is referenced on the user machine, that the
results would at least be consistent?
Is there another factor which I might have missed? Both developer and


用户计算机都有最新的服务包。

由于我通常使用旧版本进行开发,有时会在更高版本的Access中进行部署,因此重要的是,我了解可能导致部署阶段不一致的因素。

我确定这个主题有线程,如果有人有任何


user machines have up to date service packs.

Since I generally develop on older versions and deploy sometimes in later versions of Access, its very important that I understand the factors which might lead to inconsistencies at deployment stage.

Im sure there are threads on this topic, and if anyone has any



条评论或


comments, or

对相关主题的引用,非常欢迎。
references to relevant threads, they would be most welcome.



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

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