同时创建新记录和相关记录 [英] create a new record and related records simultaneously

查看:70
本文介绍了同时创建新记录和相关记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的表单frmTopics(绑定到表tblTopics)上,我添加了一个复制按钮,复制当前主题记录以创建一个新的,相同的...简单。但是,每个主题记录在tblTopicAttributes中可以有1+个相关记录(与该主题关联的每个属性的记录)。因此,我还希望复制操作在tblTopicAttributes中为新创建的tblTopics记录创建新的和相同的相关记录。我可以用SQL做到这一点,但我不知道如何翻译那到VBA。我感谢任何建议。

On my form frmTopics (bound to table tblTopics), I''ve added a Copy button that copies the current topic record to create a new, identical one...simple enough. However, each topic record can have 1+ related records in tblTopicAttributes (a record for each attribute associated with the topic). So, I also want the copy action to create new and identical related records in tblTopicAttributes for the newly-created tblTopics record. I can do this with SQL but I''m not sure how to "translate" that to VBA. I appreciate any suggestions.

推荐答案

您可以创建如下查询:
You can create the query like:
展开 | 选择 | 换行 | 行号


我理解原理,但物流/时间混淆了我。说我在frmTopics上选择了一个记录。我想复制当前主题记录及其所有相关属性。所以我点击我的复制按钮,然后执行下面的代码,我就把它带到了闪亮的新记录:

I understand the principle, but the logistics/timing confuse me. Say I''m on frmTopics with a record selected. I want to to copy the current topic record and all its associated attributes. So I click my Copy button and voila, the following code executes and I''m taken to the shiny new record:

展开 | 选择 | 换行 | 行号



我理解这个原则,但物流/时间让我感到困惑。说我在frmTopics上选择了一个记录。我想复制当前主题记录及其所有相关属性。所以我点击我的复制按钮,然后执行下面的代码,我就把它带到了闪亮的新记录:

I understand the principle, but the logistics/timing confuse me. Say I''m on frmTopics with a record selected. I want to to copy the current topic record and all its associated attributes. So I click my Copy button and voila, the following code executes and I''m taken to the shiny new record:

展开 | 选择 | 换行 | 行号


这篇关于同时创建新记录和相关记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆