Home Database Mysql Tutorial ACCESS数据库重新编号自动编号字段

ACCESS数据库重新编号自动编号字段

Jun 07, 2016 pm 04:23 PM
access Field database serial number automatic

如何在 Access 中重置“自动编号”字段值。在 Access 中删除某个表中的一些行或所有行时,“自动编号”字段不会自动重置。要重置“自动编号”字段值并刷新引用表中的“自动编号”值,必 需手动执行一些任务。 注意:在执行下面的步骤之前必须备份数据库。 重

  如何在 Access 中重置“自动编号”字段值。在 Access 中删除某个表中的一些行或所有行时,“自动编号”字段不会自动重置。要重置“自动编号”字段值并刷新引用表中的“自动编号”值,必 需手动执行一些任务。
    注意:在执行下面的步骤之前必须备份数据库。
    重置单个表中的“自动编号”字段
    要重置“自动编号”字段值,可以使用方法 1 或方法 2。
    方法 1
    可以重置“自动编号”字段值,使其与表中的一个字段相对应。为此,请按照下列步骤操作:
    1.从主表中删除“自动编号”字段。记下“自动编号”字段名称。
    2.在左窗格中单击“查询”。在右窗格中双击“在设计视图中创建查询”。
    3.在“显示表”对话框中,选择主表。单击“添加”,然后单击“关闭”。
    4. 在主表的表视图中双击所需字段,以选择该字段。
    5.选择需要的“排序”顺序。
    6.在“查询”菜单中,单击“生成表查询”。在“表名称”文本框中键入新的表名称,然后单击“确定”。
    7.在“查询”菜单上,单击“运行”。
    8. 将显示带有以下文本的对话框:“您正准备向新表粘贴 # 行。”单击“是”以插入行。
    9.在“文件”菜单上,单击“关闭”。单击 “否”关闭“生成表查询”窗口。
    10.在左窗格中单击“表”。右键单击新表,然后单击“设计视图”。 11.在表的“设计”视图中,添加与步骤 1 中删除的字段名称相同的“自动编号”字段。将此“自动编号”字段添加到新表中,然后保存该表。
    12.关闭“设计”视图窗口。
    13.重命名主表。将新表名称重命名为主表名称。
    方法 2
    也可以使用方法 2 来重置“自动编号”字段值,请按照下列步骤操作:
    1.从主表中删除“自动编号”字段。记下“自动编号”字段名称。
    2.复制主表的结构,然后创建新表。
    3.在左窗格中单击“查询”。在右窗格中单击“在设计视图中创建查询”。
    4.在“显示表”对话框中,选择主表。单击“添加”,然后单击“关闭”。
    5.要选择字段,请双击需要的字段。在主表的“表”视图中对除了“自动编号”字段外的所有字段进行此操作。
    6.在“查询”菜单上,单击“追加查询”。这将更改查询类型。
     7.从“表名称”列表中,选择您在步骤 1 中创建的新表。单击“确定”。
    8.在“查询”菜单上,单击“运行”。
    9.将显示带有以下文本的对话框:“您正准备追加 # 行。”单击“是”将行追加到新表中。
    10.在“文件”菜单上,,单击“关闭”。单击“否”关闭“追加查询”窗口。
    11.在左窗格中单击“表”。右键单击新表,然后单击“设计视图”。
     12.在表的“设计”视图中,添加与步骤 1 中删除的字段名称相同的“自动编号”字段。将此“自动编号”字段添加到新表中,然后保存该表。  13.关闭“设计”视图窗口。
    14.重命名主表。将新表名称重命名为主表名称。
    重置带引用表的表中的“自动编号”字段
    下面的步骤说明如何为具有引用表的表重置“自动编号”字段。如果有多个引用表,则必须对每个引用表执行下列步骤。
    1.删除表之间的关系。
    2.将主表的“自动编号”字段设为数字数据类型。删除主键。
    3.在主表中创建数据类型为“自动编号”的新字段。保存该表。
    4.在引用表中创建数据类型为数字的新字段。保存该表。
    5.要创建更新查询,以将引用表中的新字段更新为主表中的新“自动编号”字段,请按照下列步骤操作:
    a. 在左窗格中单击“查询”。在右窗格中单击“在设计视图中创建查询”。这将创建新查询。
    b. 在“显示表”对话框中,选择主表和引用表。单击“添加”来添加主表和引用表。单击“关闭”。
    c. 单击主表中以前链接到引用表的字段。使用拖放功能将该字段放到引用表中以前链接的字段上。这样将在这两个表之间创建基于原始链接字段的联接。
    d. 在“查询”菜单上,单击“更新查询”。
    e. 双击引用表中的新字段,将其添加到字段列表中。( )
    f. 在“更新到”字段中,键入 [主表名].[新自动编号字段],以更新引用表中的新字段值。
    g. 在“查询”菜单上,单击“运行”。
    h. 将显示带有以下文本的对话框:“您正准备更新 # 行。”单击“是”将行追加到新表中。
    i. 在“文件”菜单上,单击“关闭”。单击“否”关闭“更新查询”窗口。
    6.从主表和引用表中删除原始链接字段。
     7.将新“自动编号”字段重命名为原始名称。
    8.重新创建主键以及表之间的关系。此过程重置“自动编号”字段,然后用正确的键值更新引用表。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1665
14
PHP Tutorial
1269
29
C# Tutorial
1249
24
How to configure zend for apache How to configure zend for apache Apr 13, 2025 pm 12:57 PM

How to configure Zend in Apache? The steps to configure Zend Framework in an Apache Web Server are as follows: Install Zend Framework and extract it into the Web Server directory. Create a .htaccess file. Create the Zend application directory and add the index.php file. Configure the Zend application (application.ini). Restart the Apache Web server.

Oracle's Role in the Business World Oracle's Role in the Business World Apr 23, 2025 am 12:01 AM

Oracle is not only a database company, but also a leader in cloud computing and ERP systems. 1. Oracle provides comprehensive solutions from database to cloud services and ERP systems. 2. OracleCloud challenges AWS and Azure, providing IaaS, PaaS and SaaS services. 3. Oracle's ERP systems such as E-BusinessSuite and FusionApplications help enterprises optimize operations.

MySQL vs. Other Databases: Comparing the Options MySQL vs. Other Databases: Comparing the Options Apr 15, 2025 am 12:08 AM

MySQL is suitable for web applications and content management systems and is popular for its open source, high performance and ease of use. 1) Compared with PostgreSQL, MySQL performs better in simple queries and high concurrent read operations. 2) Compared with Oracle, MySQL is more popular among small and medium-sized enterprises because of its open source and low cost. 3) Compared with Microsoft SQL Server, MySQL is more suitable for cross-platform applications. 4) Unlike MongoDB, MySQL is more suitable for structured data and transaction processing.

MySQL: Structured Data and Relational Databases MySQL: Structured Data and Relational Databases Apr 18, 2025 am 12:22 AM

MySQL efficiently manages structured data through table structure and SQL query, and implements inter-table relationships through foreign keys. 1. Define the data format and type when creating a table. 2. Use foreign keys to establish relationships between tables. 3. Improve performance through indexing and query optimization. 4. Regularly backup and monitor databases to ensure data security and performance optimization.

Using Dicr/Yii2-Google to integrate Google API in YII2 Using Dicr/Yii2-Google to integrate Google API in YII2 Apr 18, 2025 am 11:54 AM

VprocesserazrabotkiveB-enclosed, Мнепришлостольностьсясзадачейтерациигооглапидляпапакробоглесхетсigootrive. LEAVALLYSUMBALLANCEFRIABLANCEFAUMDOPTOMATIFICATION, ČtookazaLovnetakProsto, Kakaožidal.Posenesko

What is apache server? What is apache server for? What is apache server? What is apache server for? Apr 13, 2025 am 11:57 AM

Apache server is a powerful web server software that acts as a bridge between browsers and website servers. 1. It handles HTTP requests and returns web page content based on requests; 2. Modular design allows extended functions, such as support for SSL encryption and dynamic web pages; 3. Configuration files (such as virtual host configurations) need to be carefully set to avoid security vulnerabilities, and optimize performance parameters, such as thread count and timeout time, in order to build high-performance and secure web applications.

How to solve nginx current limit How to solve nginx current limit Apr 14, 2025 pm 12:06 PM

The Nginx current limit problem can be solved by: use ngx_http_limit_req_module to limit the number of requests; use ngx_http_limit_conn_module to limit the number of connections; use third-party modules (ngx_http_limit_connections_module, ngx_http_limit_rate_module, ngx_http_access_module) to implement more current limit policies; use cloud services (Cloudflare, Google Cloud Rate Limiting, AWS WAF) to DD

Real-World MySQL: Examples and Use Cases Real-World MySQL: Examples and Use Cases Apr 14, 2025 am 12:15 AM

MySQL's real-world applications include basic database design and complex query optimization. 1) Basic usage: used to store and manage user data, such as inserting, querying, updating and deleting user information. 2) Advanced usage: Handle complex business logic, such as order and inventory management of e-commerce platforms. 3) Performance optimization: Improve performance by rationally using indexes, partition tables and query caches.

See all articles