更快地编辑和删除MS Access表中的条目 [英] edit and delete entries from MS Access table faster

查看:69
本文介绍了更快地编辑和删除MS Access表中的条目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我仍​​然是使用MS Access和VB编程的新手。我使用我的VB中的DAO连接来访问MS Access

表中的条目。

。我在编辑和删除我的

表中的条目时遇到了麻烦,因为当我的表变得越来越大时,它变得越来越慢。我现在正在做的是获取要编辑/删除的

条目的ID,我必须从第一个条目循环直到

我找到了正确的ID然后编辑/删除所述条目(非常糟糕

设计:()。有没有办法快速做到这一点?请帮忙!


谢谢!


nick_faye

解决方案

" nick_faye"< iv ****** @ yahoo。 com>在消息中写道

news:8a ************************** @ posting.google.c om。 ..

大家好,

我仍然是使用MS Access和VB编程的新手。我使用从VB到DAO的DAO连接访问我的MS Access
表上的条目。我在编辑和删除我的
表中的条目时遇到了麻烦,因为当我的表变得越来越大时,它变得越来越慢。我是什么意思我现在正在做的是获取要编辑/删除的
条目的ID,我ave从第一次进入循环直到
我找到了正确的ID,然后编辑/删除了所述条目(非常糟糕
设计:()。有没有办法快速做到这一点?请帮忙!

谢谢!

nick_faye




我认为你的意思是你打开了一个DAO记录集,包含你桌子的

内容。


如果不知道你为什么这样做,很难给出建议但是

一般不需要打开记录集来更新或删除带有已知主键的
a记录。假设您的ID位于名为ID的变量

中,您可以删除这样的记录:


CurrentDb.Execute" DELETE FROM my_table WHERE ID = &安培; ID,

dbFailOnError


除了构造SQL UPDATE

语句而不是删除。


" Brian" < BC ** @ IHATESPAMclara.co.uk>在消息新闻中写道:< 10 **************** @ lotis.uk.clara.net> ...

" nick_faye" < 4 ****** @ yahoo.com>在消息中写道
新闻:8a ************************** @ posting.google.c om ...

大家好,

我仍然是使用MS Access和VB编程的新手。我使用我的VB中的DAO连接来访问MS Access
表上的条目。我在编辑和删除我的
表中的条目时遇到了麻烦,因为当我的表越来越大时,它变得越来越慢。我现在正在做的是获取要编辑/删除的
条目的ID,我必须从第一个条目循环直到
我找到了正确的ID,然后编辑/删除了所述条目(非常糟糕
设计:()。有没有办法快速做到这一点?请帮忙!

谢谢!

nick_faye


我认为你的意思是你打开了一个包含你桌子内容的DAO记录集。

在不知道为什么的情况下提供建议很难你是这样做的,但是
通常不需要打开记录集来更新或删除具有已知主键的记录。假设你的ID在变量中
命名为ID,你可以删除这样的记录:

CurrentDb.Execute" DELETE FROM my_table WHERE ID ="& ID,
dbFailOnError
<可以对更新进行相同的操作,除了您构造SQL UPDATE
语句而不是一个删除。




嗯,那怎么样!非常感谢。我不知道我能做到这一点。我虽然
不熟悉SQL,但我只是谷歌吧。

再次,谢谢。


" nick_faye" < 4 ****** @ yahoo.com>在消息中写道

新闻:8a ************************* @ posting.google.co m ... < blockquote class =post_quotes>" Brian" < BC ** @ IHATESPAMclara.co.uk>在消息中写道



新闻:< 10 **************** @ lotis.uk.clara.net> ...

" nick_faye" < 4 ****** @ yahoo.com>在消息中写道
新闻:8a ************************** @ posting.google.c om ...

大家好,

我仍然是使用MS Access和VB编程的新手。我使用我的VB中的DAO连接来访问MS Access
表上的条目。我在编辑和删除我的
表中的条目时遇到了麻烦,因为当我的表越来越大时,它变得越来越慢。我现在正在做的是获取要编辑/删除的
条目的ID,我必须从第一个条目循环直到
我找到了正确的ID,然后编辑/删除了所述条目(非常糟糕
设计:()。有没有办法快速做到这一点?请帮忙!

谢谢!

nick_faye


我认为你的意思是你打开了一个包含
桌面内容的DAO记录集。

在不知道为什么的情况下提供建议很难你是这样做的,
但是通常不需要打开记录集来更新或
删除具有已知主键的记录。假设你的ID在
变量名为ID,你可以删除这样的记录:

CurrentDb.Execute" DELETE FROM my_table WHERE ID ="& ID,
dbFailOnError
<除了构造SQL UPDATE
语句而不是D语言之外,对更新也可以这样做ELETE。



那么,那怎么样!非常感谢。我不知道我能做到这一点。我虽然不熟悉SQL,但我只是谷歌吧。
再次,谢谢。




不幸的是,如果你有一个97以后的Access版本,你将搜索

帮助系统徒劳无助的SQL帮助。但是,如果你有或者
可以获得Access 97,那么帮助系统会全面覆盖SQL。


另外,如果你的UPDATE语句有问题,我相信你会在这个新闻组中获得

帮助。


Hi guys,

i''m still a newbie in using MS Access and in VB programming. I am
using DAO connection from my VB to access the entries on my MS Access
table. I am having trouble in editting and deleting entries from my
table because it becomes slower and slower when my table is getting
bigger and bigger. What I am doing right now is get the ID of the
entry to be editted/deleted and I have to loop from first entry until
I found the right ID and then edit/delete the said entry (very lousy
design :( ). Is there a way of doing this the fast way? Please help!

Thanks!

nick_faye

解决方案

"nick_faye" <iv******@yahoo.com> wrote in message
news:8a**************************@posting.google.c om...

Hi guys,

i''m still a newbie in using MS Access and in VB programming. I am
using DAO connection from my VB to access the entries on my MS Access
table. I am having trouble in editting and deleting entries from my
table because it becomes slower and slower when my table is getting
bigger and bigger. What I am doing right now is get the ID of the
entry to be editted/deleted and I have to loop from first entry until
I found the right ID and then edit/delete the said entry (very lousy
design :( ). Is there a way of doing this the fast way? Please help!

Thanks!

nick_faye



I presume that what you mean is you''ve opened a DAO recordset containing the
contents of your table.

It''s hard to give advice without knowing WHY you are doing it like this, but
there is generally no need to open a recordset in order to update or delete
a record with a known primary key. Assuming that your ID is in a variable
named "ID", you could delete the record like this:

CurrentDb.Execute "DELETE FROM my_table WHERE ID = " & ID,
dbFailOnError

The same can be done for an update, except you construct an SQL UPDATE
statement instead of a DELETE.


"Brian" <bc**@IHATESPAMclara.co.uk> wrote in message news:<10****************@lotis.uk.clara.net>...

"nick_faye" <iv******@yahoo.com> wrote in message
news:8a**************************@posting.google.c om...

Hi guys,

i''m still a newbie in using MS Access and in VB programming. I am
using DAO connection from my VB to access the entries on my MS Access
table. I am having trouble in editting and deleting entries from my
table because it becomes slower and slower when my table is getting
bigger and bigger. What I am doing right now is get the ID of the
entry to be editted/deleted and I have to loop from first entry until
I found the right ID and then edit/delete the said entry (very lousy
design :( ). Is there a way of doing this the fast way? Please help!

Thanks!

nick_faye



I presume that what you mean is you''ve opened a DAO recordset containing the
contents of your table.

It''s hard to give advice without knowing WHY you are doing it like this, but
there is generally no need to open a recordset in order to update or delete
a record with a known primary key. Assuming that your ID is in a variable
named "ID", you could delete the record like this:

CurrentDb.Execute "DELETE FROM my_table WHERE ID = " & ID,
dbFailOnError

The same can be done for an update, except you construct an SQL UPDATE
statement instead of a DELETE.



Well, how about that! Thanks a lot. I didn''t know I can do that. I
am not that familiar with SQL though but I''ll just google for it.
Again, thanks.


"nick_faye" <iv******@yahoo.com> wrote in message
news:8a*************************@posting.google.co m...

"Brian" <bc**@IHATESPAMclara.co.uk> wrote in message


news:<10****************@lotis.uk.clara.net>...

"nick_faye" <iv******@yahoo.com> wrote in message
news:8a**************************@posting.google.c om...

Hi guys,

i''m still a newbie in using MS Access and in VB programming. I am
using DAO connection from my VB to access the entries on my MS Access
table. I am having trouble in editting and deleting entries from my
table because it becomes slower and slower when my table is getting
bigger and bigger. What I am doing right now is get the ID of the
entry to be editted/deleted and I have to loop from first entry until
I found the right ID and then edit/delete the said entry (very lousy
design :( ). Is there a way of doing this the fast way? Please help!

Thanks!

nick_faye



I presume that what you mean is you''ve opened a DAO recordset containing the contents of your table.

It''s hard to give advice without knowing WHY you are doing it like this, but there is generally no need to open a recordset in order to update or delete a record with a known primary key. Assuming that your ID is in a variable named "ID", you could delete the record like this:

CurrentDb.Execute "DELETE FROM my_table WHERE ID = " & ID,
dbFailOnError

The same can be done for an update, except you construct an SQL UPDATE
statement instead of a DELETE.



Well, how about that! Thanks a lot. I didn''t know I can do that. I
am not that familiar with SQL though but I''ll just google for it.
Again, thanks.



Unfortunately, if you have an Access version later than 97, you will search
the help system in vain for assistance with SQL. However, if you have or
can get hold of Access 97, the help system covers SQL comprehensively.

Also, if you have trouble with your UPDATE statement, I''m sure you will get
help in this newsgroup.


这篇关于更快地编辑和删除MS Access表中的条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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