重命名链接表 MDB 文件对中的字段?
我有一个使用 MS-JET 链接表的 Access 2003 数据库(即有两个 *.mdb 文件)。总体任务是迁移到SQL Server。然而,现有数据库有多个字段,其中包含空格和其他字符,这会扰乱两个 Access 迁移向导。因此,中间任务是使用更新的字段名称制作现有 mdb 的版本。
“简单地”更改 UI mdb 文件中的字段名称不起作用,因为链接表在该 mdb 中是只读的。首先更新 Data mdb 文件字段名称不起作用,因为 UI mdb 随后在启动时抛出不稳定并且 Access 放弃。
我正在寻找建议,但我可以看到的选项是:
将数据 mdb 重新集成回 UI 中,进行更新,然后重新导出数据。对我来说似乎风险很大(系统已上线,除了绝对必要之外,不想使用任何数据)。
我在这里查看了几个与使用 VBA 代码更改 ODBC 详细信息相关的答案,这很有趣,并且我可以看到如何以编程方式编辑链接表的名称。这行得通吗?有更好的方法吗?
取消链接所有链接表,然后在 UI mdb 中编辑剩余的表单、报告、查询(但这会起作用吗??)并编辑数据 mdb 字段,最后重新链接所有内容。会崩溃吗?? ...似乎有可能。
有什么建议吗? 露丝
I have an Access 2003 database using MS-JET linked tables (that is, there are two *.mdb files). The overall task is to move to SQL server. However the existing databases have multiple fields with spaces and other characters that upset both of the Access migration wizards. So the intermediate task is to make a version of the existing mdb's with updated field names.
"Simply" changing field names in the UI mdb file doesn't work, because of the linked tables being read-only in that mdb. Updating the Data mdb file field names first doesn't work because the UI mdb then throws a wobbly on startup and Access gives up.
I'm looking for suggestions, but options I can see are:
re-integrate the Data mdb back into the UI one, do the updates, then re-export the data. Seems very risky to me (system is live, don't want to play with data any more than strictly necessary).
I've looked at several answers here relating to changing ODBC details with VBA code, which is interesting, and I can see how I might be able to programmatically edit the linked tables' names. Is this going to work? Is there a better way?
Unlink all linked tables, then edit in UI mdb the remaining forms, reports, queries (but would that work??) and edit the Data mdb fields, and finally relink everything. Will it fall apart?? ... seems likely.
Any suggestions?
Ruth
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
每次接管现有的 Access 应用程序时,我都会经历这个过程 - 在对它做任何重要的事情之前,我必须使其符合我自己的命名约定标准。最近,我构建了一个快速而简单的实用程序来重命名字段。它是为我制作的,几乎没有错误恢复,并且 UI 很丑陋,但它可能比自己做更快。
I go through this process every time I take over an existing Access application -- I have to bring it up to my own standards for naming conventions before I do anything significant with it. Recently I built a quick-and-dirty utility to rename fields. It was made for me and has very little error recovery, and a UI that is ugly, but it might be faster than doing it yourself.
查看曲目名称自动更正提供的内容。
名称自动更正在 Microsoft Access 中的工作原理 复制 UI MDB,删除链接表,然后从数据 MDB 导入它们(作为表而不是链接)。启用自动更正后,Access 将尝试将字段名称更改传播到任何使用它们的地方(例如在表单中)。它不太可能捕获 100% 的必要更改,但它应该可以解决其中的很大一部分。然后,您需要手动追踪并修复其余部分。
修复所有问题后,您可以使用该 MDB 版本将表“升级”到 SQL Server。然而,一个巨大的复杂性是,当您对新版本进行更改时,原始数据库是否处于“活动”状态。如果您绝对无法在此期间停止数据库服务,则可以丢弃新表中的数据,然后使用“附加”查询,将旧字段名称别名为新字段名称以提取最新数据。
最后,关于自动更正的警告:不要在数据库的生产版本中启用它,因为可能会发生奇怪的事情。 IMO 中最安全的方法是将其打开,完成对象名称更改,然后再次将其关闭。
See what track name autocorrect offers. How Name AutoCorrect Works in Microsoft Access
Make a copy of your UI MDB, delete the linked tables, then import them (as tables rather than links) from the Data MDB. Once you enable autocorrect, Access will attempt to propagate your field name changes wherever they are used (in forms for example). Unlikely it will catch 100% of the necessary changes, but it should resolve a big chunk of them. You would then need to manually track down and fix the rest.
Once you have everything fixed, you could use that MDB version to "upsize" your tables to SQL Server. However, one huge complication is if the original database is "live" while you're making changes to the new version. If you absolutely can't take the database out of service in the interim, you could discard the data from the new tables, then use "append" queries which alias the old to new field names to pull in the latest data.
Finally, a warning about autocorrect: do not leave it enabled in the production version of your database because strange things can happen. The safest approach IMO is to turn it on, complete your object name changes, then turn it back off again.
如果您需要在项目中传播名称更改,您可能会发现 Rick Fisher 的
查找和替换
工具很有帮助。我多年来一直依赖它(尽管我最近没有做太多 Access 开发): http:// www.rickworld.com/products.html我认为这个工具会为您更改表和字段的名称,但我不确定。我主要用它来查找对其他查询、表单和报表属性以及 VBA 代码中的表和查询的引用。
You might find Rick Fisher's
Find and Replace
tool helpful if you need to propagate name changes through the project. I've relied on it for years (though I don't do much Access development lately): http://www.rickworld.com/products.htmlI think this tool will change the names of tables and fields for you but I am not sure. I mostly used it for finding references to tables and queries in other queries, form and report properties, and VBA code.