导入,追加/更新问题。 [英] Import, Append/Update question.

查看:36
本文介绍了导入,追加/更新问题。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我第一次在这里发帖,所以如果我犯了任何错误(即错误的论坛区等),我很抱歉。


我有一个Access数据库,我有将文本文件导入并将其附加到某个表。我知道我的问题的这一部分已经得到了解答,并且我很好地理解了如何在搜索下一部分的答案之后做得很好。我可以将文本文件直接导入到表中,也可以导入到自己的单独表中,以便稍后将两者结合起来。我的问题是,我不能只是将新数据附加到现有表中,如果新数据的记录包含已存在的订单ID,我必须能够更新现有表中的任何记录。现有表格以避免重复。我不能不输入新数据,因为它的记录可能包含更新的信息。

希望所有这些都有意义。提前感谢大家。


谢谢,

马修

This is my first time posting here, so if I have made any mistakes (i.e. wrong forum area, etc) I am sorry.

I have an Access database that I have to import a text file into and append it to a certain table. I know this part of my question has been answered and I understand how to do it quite well after searching long and hard for an answer to my next part. I can either import the text file directly into the table or into it''s own seperate table to combine the two later. My problem however is that, I can''t just append the new data to the existing table I have to be able to update any of the records in the existing table if the new data has a record that contains an Order ID already in the existing table in order to avoid duplicates. I cannot just not enter the new data since its record may contain updated information.
Hope all of that made sense. Thanks to everyone in advance.

Thank you,

Matthew

推荐答案


这是我第一次在这里发帖,所以如果我犯了任何错误(即错误的论坛区等),我很抱歉。


我有一个Access数据库,我必须将文本文件导入并附加到某个表。我知道我的问题的这一部分已经得到了解答,并且我很好地理解了如何在搜索下一部分的答案之后做得很好。我可以将文本文件直接导入到表中,也可以导入到自己的单独表中,以便稍后将两者结合起来。我的问题是,我不能只是将新数据附加到现有表中,如果新数据的记录包含已存在的订单ID,我必须能够更新现有表中的任何记录。现有表格以避免重复。我不能不输入新数据,因为它的记录可能包含更新的信息。

希望所有这些都有意义。提前感谢大家。


谢谢,

马修
This is my first time posting here, so if I have made any mistakes (i.e. wrong forum area, etc) I am sorry.

I have an Access database that I have to import a text file into and append it to a certain table. I know this part of my question has been answered and I understand how to do it quite well after searching long and hard for an answer to my next part. I can either import the text file directly into the table or into it''s own seperate table to combine the two later. My problem however is that, I can''t just append the new data to the existing table I have to be able to update any of the records in the existing table if the new data has a record that contains an Order ID already in the existing table in order to avoid duplicates. I cannot just not enter the new data since its record may contain updated information.
Hope all of that made sense. Thanks to everyone in advance.

Thank you,

Matthew



猜猜是什么......你现在开始学习编码!你不是很兴奋吗?


这里是它的主旨。


你有一张满是进口记录的表。

你桌子的某个地方有一个订单ID字段。


您需要使用该ID为您要处理的每条记录进行查找。


如果找到订单ID,那么您运行更新查询


如果找不到订单ID,则执行插入操作。


我知道...... DUH。但是我会在一秒钟内给你的方法就是这样。


你需要插入你的表名,希望字段名称匹配。

guess what...you get to learn to code now! Aren''t you excited?

Here''s the gist of it.

You have a table full of imported records.
Somewhere in your table you have an Order ID field.

You need to do a lookup using that id for each record you want to process.

If the Order ID is found, then you run an update query

if the Order ID is not found, you do an insert.

I know...DUH. But the method I''ll give you in a second actually does that.

You''ll need to plug in your table names and hopefully the field names match.



这是我第一次在这里发帖,所以如果我犯了任何错误(即错误的论坛区等),我很抱歉。


我有一个Access数据库,我必须将文本文件导入并附加到某个表。我知道我的问题的这一部分已经得到了解答,并且我很好地理解了如何在搜索下一部分的答案之后做得很好。我可以将文本文件直接导入到表中,也可以导入到自己的单独表中,以便稍后将两者结合起来。我的问题是,我不能只是将新数据附加到现有表中,如果新数据的记录包含已存在的订单ID,我必须能够更新现有表中的任何记录。现有表格以避免重复。我不能不输入新数据,因为它的记录可能包含更新的信息。

希望所有这些都有意义。提前感谢大家。


谢谢,

马修
This is my first time posting here, so if I have made any mistakes (i.e. wrong forum area, etc) I am sorry.

I have an Access database that I have to import a text file into and append it to a certain table. I know this part of my question has been answered and I understand how to do it quite well after searching long and hard for an answer to my next part. I can either import the text file directly into the table or into it''s own seperate table to combine the two later. My problem however is that, I can''t just append the new data to the existing table I have to be able to update any of the records in the existing table if the new data has a record that contains an Order ID already in the existing table in order to avoid duplicates. I cannot just not enter the new data since its record may contain updated information.
Hope all of that made sense. Thanks to everyone in advance.

Thank you,

Matthew



准备编码?这是评论,所以希望有意义。

这个代码可以在一个按钮上,也可以在一个模块中,你可以从宏或其他东西调用它。


Ready to code? This is commented, so hopefully will make sense.
This code goes either on a button...or in a Module where you can call it from a macro or something.

展开 | 选择 < span class =codeDivider> | Wrap | 行号



准备编码?这是评论,所以希望有意义。

这个代码可以在一个按钮上,也可以在一个模块中,你可以从宏或其他东西调用它。

Ready to code? This is commented, so hopefully will make sense.
This code goes either on a button...or in a Module where you can call it from a macro or something.

展开 | 选择 < span class =codeDivider> | Wrap | 行号


这篇关于导入,追加/更新问题。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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