从具有ID自动生成ID的Excel附加到Access表的值(Append values to Access table from excel with ID autogenerated)

我有一个访问数据库,其中包含一些每日更新一些值的表。 我需要表格有一个ID字段,当从excel导入表格的其他值时,该字段会自动生成。 我希望通过保留按钮和编写VBA代码来自动完成所有操作。 现在我有一个表格,可以将值导入表格,但它只输入我拥有的确切值。 我还需要一个额外的ID列,我必须在导入时自动生成。 请帮帮我。

Excel表格样本:

ProductName | ProductValue ------------+------------------ ABC | 76 SDF | 87

数据库表

ID | ProductName | Product Value ----+---------------+----------------- 1 | ABC | 76 2 | SDF | 87

Excel工作表使用新值更新每个日期,并且必须将其放入访问数据库,ID会自动递增。

I have a access database with some tables which get updated daily with some values. I need the tables to have a ID field which is autogenerated when the other values of the table are imported from excel. I want to automate all by keeping a button and writing a VBA code. Right now I have a form which imports the value into the table, but it just imports the exact value which I have . I also need a extra column of ID that has to be auto generated when I import. Please help me.

Excel Sheet Sample:

ProductName | ProductValue ------------+------------------ ABC | 76 SDF | 87

DATABASE TABLE

ID | ProductName | Product Value ----+---------------+----------------- 1 | ABC | 76 2 | SDF | 87

Excel sheet updates each date with new value and it has to be put to the access db with ID automatically incremented.

最满意答案

在Access中创建表时,您对要创建的新列的数据类型有不同的选项。 其中一种数据类型称为“自动编号”。 这里有一些信息: http : //en.wikipedia.org/wiki/AutoNumber

将列ID设置为autoNumber并将其设为主键。 现在,每次在表ID中插入关系时,ID都会自动增加一个新数字。

When you create a table in Access you have different options for the datatype of the new columns you want to create. One of the datatypes is called "AutoNumber". Here some information: http://en.wikipedia.org/wiki/AutoNumber

Set your column ID as an autoNumber and make it a primary key. Now everytime you insert a relation into the table ID will automatically increment a new number.

从具有ID自动生成ID的Excel附加到Access表的值(Append values to Access table from excel with ID autogenerated)

我有一个访问数据库,其中包含一些每日更新一些值的表。 我需要表格有一个ID字段,当从excel导入表格的其他值时,该字段会自动生成。 我希望通过保留按钮和编写VBA代码来自动完成所有操作。 现在我有一个表格,可以将值导入表格,但它只输入我拥有的确切值。 我还需要一个额外的ID列,我必须在导入时自动生成。 请帮帮我。

Excel表格样本:

ProductName | ProductValue ------------+------------------ ABC | 76 SDF | 87

数据库表

ID | ProductName | Product Value ----+---------------+----------------- 1 | ABC | 76 2 | SDF | 87

Excel工作表使用新值更新每个日期,并且必须将其放入访问数据库,ID会自动递增。

I have a access database with some tables which get updated daily with some values. I need the tables to have a ID field which is autogenerated when the other values of the table are imported from excel. I want to automate all by keeping a button and writing a VBA code. Right now I have a form which imports the value into the table, but it just imports the exact value which I have . I also need a extra column of ID that has to be auto generated when I import. Please help me.

Excel Sheet Sample:

ProductName | ProductValue ------------+------------------ ABC | 76 SDF | 87

DATABASE TABLE

ID | ProductName | Product Value ----+---------------+----------------- 1 | ABC | 76 2 | SDF | 87

Excel sheet updates each date with new value and it has to be put to the access db with ID automatically incremented.

最满意答案

在Access中创建表时,您对要创建的新列的数据类型有不同的选项。 其中一种数据类型称为“自动编号”。 这里有一些信息: http : //en.wikipedia.org/wiki/AutoNumber

将列ID设置为autoNumber并将其设为主键。 现在,每次在表ID中插入关系时,ID都会自动增加一个新数字。

When you create a table in Access you have different options for the datatype of the new columns you want to create. One of the datatypes is called "AutoNumber". Here some information: http://en.wikipedia.org/wiki/AutoNumber

Set your column ID as an autoNumber and make it a primary key. Now everytime you insert a relation into the table ID will automatically increment a new number.