访问

数据 社区

技能解读

当前原文的自动摘译,尚未人工审校。

参考文件

在处理特定对象类型之前,请阅读相关参考文件: 当处理... · 阅读此参考表格 .bas 布局或表单控件 · references/forms.md 报告 .bas 布局、部分或排序/分组 · references/reports.md 表单或报告中的图像(添加、替换、从 OLE 转换) · references/images.md

项目概况

VCS 导出的 Access 项目位于<DatabaseName>.accdb.src/。目录名称必须与 .accdb 文件名匹配并附加 .src。

文件配对规则

对象类型 · 文件 · 注释表单 · .bas + 可选 .cls + 可选 .json · .bas = 布局,.cls = VBA 代码隐藏(如果没有代码则省略),.json = 打印设置报告 · .bas + 可选 .cls + 可选 .json · 与表单相同的二进制文本格式,.cls = VBA 代码隐藏(不常见但有效),.json = 打印设置查询 · .bas + .sql · .bas = 元数据/设计器状态,.sql = SQL 文本。始终配对

编码

所有 JSON 配置文件和 .sql 文件均使用带 BOM 的 UTF-8(字节顺序标记 EF BB BF)。编辑时必须保留 BOM。二进制文本.bas文件(表单、报告、宏)也使用带 BOM 的 UTF-8。 .bas、.cls 和 tbldef/relation .json 文件还使用 CRLF 行结尾(通过 .gitattributes 强制执行)。从头开始创建新文件:标准写入工具(包括 Claude 的 Write 工具、echo、cat <<EOF)默默地生成 UTF-8 不带 BOM 并使用 LF 结尾 - 这会损坏导入。要创建新的 VCS 文件,请显式发出字节:

安全删除清单

删除任何 Access 对象之前: 在所有 .cls、.bas、.sql 文件中搜索引用。对象可以通过以下方式引用: VBA 代码(DoCmd.OpenForm、DoCmd.OpenReport、DoCmd.OutputTo) 查询 SQL(FROM tableName、子报表 SourceObject) 表单 RecordSource 属性

流狐档案 运行与权限由流狐静态检查推断,不代表作者声明或实际测试结果。
领域
数据
作者声明的智能体
未找到明确声明;不据此推断已兼容或已测试
静态检查
88 / 100 · 启发式扫描,不代表运行安全
运行环境证据
未执行;当前没有隔离运行测试证据
作者 / 版本 / 许可证
@paramountsoftware · 未声明许可证
上下文用量评级
低消耗
接入复杂程度
即装即用
是否需要外部接口密钥
不需要
兼容的系统
未声明(默认跨平台)
运行环境要求
未检出明确要求
检测到的文件与系统行为
  • 只读
  • 允许写入 / 修改
网络行为
仅限本地
安装命令数
无(仅作为资料)

需要注意: 未声明工具权限范围;实际权限由运行环境决定。

作者说明文件(原文) SKILL.md

# Microsoft Access VCS Project Guide

Rules and gotchas for programmatically editing Access objects exported by VCS 4.x. Violations cause silent corruption or `Error 2128` on import via `LoadComponentFromText`.

## Reference Files

Read the relevant reference file before working on a specific object type:

| When working on... | Read this reference |
|---|---|
| Form `.bas` layout or form controls | `references/forms.md` |
| Report `.bas` layout, sections, or sorting/grouping | `references/reports.md` |
| Images in forms or reports (add, replace, convert from OLE) | `references/images.md` |
| Conditional formatting (forms or reports) | `references/conditional-formatting.md` |
| Queries (`.bas` + `.sql`) | `references/queries.md` |
| Tables, relationships, or ODBC connections | `references/tables-and-relationships.md` |
| VBA modules (`.bas`) or code-behind (`.cls`) | `references/vba.md` |
| Project config files (vcs-options, vcs-index, etc.) | `references/project-config.md` |
| Macros, shared images, or import/export specs | `references/other-objects.md` |

## Project Overview

A VCS-exported Access project lives in `<DatabaseName>.accdb.src/`. The directory name **must** match the `.accdb` filename with `.src` appended.

### File Pairing Rules

| Object Type | Files | Notes |
|-------------|-------|-------|
| Form | `.bas` + optional `.cls` + optional `.json` | `.bas` = layout, `.cls` = VBA code-behind (omitted if no code), `.json` = print settings |
| Report | `.bas` + optional `.cls` + optional `.json` | Same binary text format as forms, `.cls` = VBA code-behind (uncommon but valid), `.json` = print settings |
| Query | `.bas` + `.sql` | `.bas` = metadata/designer state, `.sql` = SQL text. Always paired |
| Module | `.bas` | Standard VBA module |
| Relationship | `.json` | Foreign key definition, join type, referential integrity |
| Linked Table | `.json` | Connection string, source table, attributes |
| Local Table | `.xml` | XSD schema defining columns, data types, indexes. For tables stored inside the .accdb |
| Macro | `.bas` | Access macro actions (not VBA). Simpler binary text format |
| Shared Image | `.json` + image file | `.json` = metadata (name, extension, hash), paired with actual image file (`.png`, `.jpg`, etc.) |
| Import/Export Spec | `.json` | Column definitions, delimiters, data types |
| Theme | `.thmx` | Office theme (binary OOXML archive — do not edit) |

When deleting an object, delete ALL its associated files plus its entry in `vcs-index.json`.

### Encoding

All JSON configuration files and `.sql` files use **UTF-8 with BOM** (byte order mark `EF BB BF`). The BOM must be preserved when editing. Binary text `.bas` files (forms, reports, macros) also use UTF-8 with BOM. `.bas`, `.cls`, and tbldef/relation `.json` files additionally use **CRLF** line endings (enforced via `.gitattributes`).

**Creating a new file from scratch:** standard write tools (including Claude's `Write` tool, `echo`, `cat <<EOF`) silently produce UTF-8 *without* BOM and use **LF** endings — this will corrupt the import. To create a new VCS file, emit the bytes explicitly:

```bash
printf '\xEF\xBB\xBF{\r\n  "Info": { ... }\r\n}\r\n' > path/to/new-file.json
```

Verify after writing: `od -c -N 5 path/to/new-file.json` should show `357 273 277` (the BOM) as the first three bytes, and the file should contain `\r` before each `\n`. *Editing* an existing file with `Edit`/`Read` preserves the original encoding — the BOM-stripping issue only applies to brand-new files created via `Write`.

## Safe Deletion Checklist

Before deleting any Access object:

1. **Search for references** in all `.cls`, `.bas`, `.sql` files. Objects may be referenced by:
   - VBA code (`DoCmd.OpenForm`, `DoCmd.OpenReport`, `DoCmd.OutputTo`)
   - Query SQL (`FROM tableName`, subreport `SourceObject`)
   - Form RecordSource properties
   - DLookup expressions
2. **Check for name collisions.** Objects with similar names may serve completely different purposes (e.g., an active report and a dead integration table that share a prefix).
3. **Delete all paired files** (.bas + .sql, .bas + .cls + .json, etc.)
4. **Remove from config files:** vcs-index.json, db-connection.json, hidden-attributes.json
5. **Renumber TabIndex** values in any form/report section where a control was removed
6. **Test import** in Access after changes

## Common Pitfalls

- **Commented-out code referencing kept objects:** Leave commented VBA lines alone if they reference objects you're keeping.
- **db-connection.json:** Must contain only one connection entry matching the canonical ODBC connection string used by all linked tables and pass-through queries. Never introduce plaintext passwords or user-specific credentials.

讨论

基于 GitHub Discussions。登录 GitHub 即可参与讨论、点赞、订阅更新。