编写追加销毁表的代码 [英] writing code for an append to destroy table

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

问题描述



我知道我必须首先创建附加表,然后创建我知道如何在Access 2010中执行的附加查询。


我有几千条正在被摧毁的记录。他们的状态将从A变为D,我宁愿将它们保存在一个单独的表中。


编写必要代码的最简单方法是将这些被破坏的记录自动转移到到新桌子?我还需要使用过滤器吗?我从来没有参加过Access课程,所以我大部分时间都在学习。任何你可以给我的帮助将不胜感激。


谢谢,

Michael Kirkby

Hi,
I know I have to create the Append Table first and then the Append query which I know how to do in Access 2010.

I have several thousands of records that are in the process of being destroyed. Their status will change form A to D and I would prefer to keep them in a separate table.

What is the easiest way to write the necessary code so that these destroyed records automatically transfer over to the new table? Do I also need to use a filter? I never took a course in Access so I mostly learn as I go along. Any assistance you could give me will be appreciated.

Thanks,
Michael Kirkby

推荐答案

迈克尔,


请提供更多有关您问题的信息。通常情况下,我们不会摧毁 Access中的表。我们可以删除记录,也可以删除整个表格,但我不确定你想要做什么。


你只是想要识别某组记录(上面定义为以前为A,但现在它们是D),然后将这些记录复制到另一个表,然后从原始表中删除这些记录?


另外,你打算怎么做?您是否设计了可以进行更新的表单?你到目前为止尝试了什么?


我知道你说你是新手,这不是问题 - 我们都去过那里。但是,一些其他信息可以帮助我们更好地帮助您。
Michael,

Please provide a little more information on your question. Typically, we don''t "destroy" tables in Access. We can delete records, and it is also possible to delete an entire Table, but I''m not exactly sure what it is that you want to do.

Do you simply want to identify a certain set of records (defined above as previously being "A", but now they are "D"), and then copy those records to a different table, and then delete those records from their original table?

Also, how are you planning to do this? Have you designed a form that will make these updates? What have you tried so far?

I know you say you are a novice, and that''s not a problem--we''ve all been there. However, some additional information would help us help you better.


每个记录或条目都有一个Status字段。当我们销毁存储中的实际文件或框时,数据库中记录的状态从A变为活动变为D被破坏。

我想要做的是为所有文件创建一个表标记为D以自动附加到此Destroyed表。

我已经写了一个关于文件类型和位置查询的字符串,但我只是不确定如何编写这个。有什么建议吗?
Each record or entry has a Status field. When we destroy the actual file or box in storage then the record''s status on the database changes from A for active to D destroyed.
What I want to do is to create a table for all files marked as D to be automatically appended to this Destroyed table.
I''ve written a string for queries regarding file type and location but I''m just not sure how to write this one. Any suggestions?


一种简单的方法(如果你想保持与原始表相同的字段结构,那么首先要复制具有原始记录的表。 (如果表是链接表,则必须转到后端数据库。)只需选择表,Ctrl-C,Ctrl-V。访问将询问您是否需要Straucture和数据结构。选择仅结构。


然后,创建一个选择这些记录中所有字段的查询,其中唯一的标准应该是[FileStatus] =''D''。在查询中设计选项卡,选择附加查询。它会询问要附加哪个表并选择刚刚创建的新表。


保存该查询(简单地说它很简单)。


要从原始表中删除这些记录,请使用相同的条件创建另一个查询,但将其设置为删除查询。这两个查询在按顺序运行时应该复制一切 文件状态为D的记录进入新的存档表,然后删除这些记录。


希望这会有所帮助。
A simple way to do this (if you want to maintain the same field structure as the original table is to first, make a copy of the Table that has the original records. (If the table is a linked table, you must go to the Back end DB.) Simply select the Table, Ctrl-C, Ctrl-V. Access will ask if you want the Straucturea nd Data or Structure Only. Choose Structure Only.

Then, create a query that selects all the fields in these records, in which your only criteria should be "[FileStatus] = ''D''". In the Query Design Tab, select "Append Query". It will ask which Table to append to and select the new table you just made.

Save that query (it shoudl work that simply).

To get rid of those records from the original Table, create another query with the same criteria, but make it a "Delete Query". These two queries, when run sequentially should copy all the records with File Status "D" into the new archive table and then delete those records.

Hope this helps.


这篇关于编写追加销毁表的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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