ms 代码优化
- 作者仓库星标 15
- 作者仓库 ms-access-ai-skill
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:
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:
- Search for references in all
.cls,.bas,.sqlfiles. Objects may be referenced by:- VBA code (
DoCmd.OpenForm,DoCmd.OpenReport,DoCmd.OutputTo) - Query SQL (
FROM tableName, subreportSourceObject) - Form RecordSource properties
- DLookup expressions
- VBA code (
- 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).
- Delete all paired files (.bas + .sql, .bas + .cls + .json, etc.)
- Remove from config files: vcs-index.json, db-connection.json, hidden-attributes.json
- Renumber TabIndex values in any form/report section where a control was removed
- 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.
- 流狐分类
- 数据
- 作者声明 Agent
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 88 / 100 · 启发式扫描,不代表运行安全
- 作者 / 版本 / 许可
- @paramountsoftware · 未声明 license
- 流狐 Token 估算
- 低消耗
- 流狐接入估算
- 即装即用
- 是否需要外部 API Key
- 未发现要求
- 检测到的系统要求
- 未声明
- 底层运行要求
- 未声明
- 检测到的文件与系统行为
-
- 只读
- 允许写入 / 修改
- 检测到的网络行为
- 仅限本地
- 安装命令数
- 无(仅作为资料)
档案由构建时根据 SKILL.md 与安装命令自动衍生,可能与作者实际意图存在差异。
需要注意: 未限定 allowed-tools,默认拥有全部工具权限。
作者没有在当前 SKILL.md 中定义固定输出样例。 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
A VCS-exported Access project lives in <DatabaseName>.accdb.src/. The directory name must match the .accdb filename with .src appended.
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…
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…
Before deleting any Access object: Search for references in all .cls, .bas, .sql files. Objects may be referenced by: VBA code (DoCmd.OpenForm, DoCmd.OpenReport, DoCmd.OutputTo)
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…
# 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 |
… 作者原文负责流程事实;流狐只索引当前章节、要点、文件与命令。
章节 -> Reference Files → Project Overview → File Pairing Rules → Encoding → Safe Deletion Checklist → Common Pitfalls
要点 -> must · UTF-8 with BOM · CRLF · Creating a new file from scratch · LF · Search for references · Check for name collisions. · Delete all paired files
文件/命令 -> Error 2128 · LoadComponentFromText · .bas · references/forms.md · references/reports.md · references/images.md · references/conditional-formatting.md · .sql
内容 SHA-256 -> 12c52230ad16
原文结构
适用与边界
原文中的明确线索
Error 2128、LoadComponentFromText、.bas、references/forms.md、references/reports.md、references/images.md、references/conditional-formatting.md、.sql