在子表单-vba代码中生成记录 [英] generating records in subform-vba code

查看:125
本文介绍了在子表单-vba代码中生成记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

你可以帮我写一个VBA代码,允许在一个子窗体中生成父窗体的所有记录。

我创建了一个生成产品代码的表单

ABCDE

每个A,B,C,D和E都有一个不同的下拉列表选项(1,2,3,4)但每个1,2,3,4都有一个Vcode列表(即option1有V102,v103和V123)

我想要有完整的Vcodes列表选择其中一个选项时,在一个子表单中)我知道它很复杂但可能:)

表单名称:部件号,

子表单名称:V代码


任何想法都会非常感激


thnx

magda

解决方案

您好。


我可以回忆一下(77.6 KB,58 views)


我担心我的db会更复杂一点主要形式有单独的字段A,B,C,D,当每个字段有一个下拉列表,可选择1,2,3,4个选项,每个选项1,2,3,4已分配Vcodes。 />
想法是在从主窗体中选择选项时将所有Vcode放在一个子窗体中。我知道这很难解释...



我担心我的数据库有点复杂。当每个字段都有一个下拉列表,选择1,2,3时,主窗体有单独的字段A,B,C,D ,4个选项和每个选项1,2,3,4已经分配了Vcodes。

想法是在从主窗体中选择选项时将所有Vcode放在一个子窗体中。嗯知道它会很难解释...



该示例显示了使用3表多对多关系上的表外连接创建记录槽的一般方法。我确定你的数据库有点复杂。 ;)无论我不确定它都不能在你的情况下使用。


如果你发布所有相关数据集的元数据,你的解释会更有意义。 />
以下是如何发布表MetaData的示例:
表名= tblStudent

展开 | 选择 | Wrap | 行号

hi guys,
could you please help me to write a VBA code that will allow to generate all records from parent form in one subform.
I created a form which generates the product code
ABCDE
Each A,B, C,Dand E has a drop down list with different options (1,2,3,4)but each 1, 2, 3,4 has a list of Vcodes(i.e option1 has V102,v103 andV123)
I would like to have full list of Vcodes in one subform when chosing one of the option) Iknow it''s complicated but possible:)
form name:Part Number,
subform name: V Codes

any ideas would be greatly appreciated

thnx
magda

解决方案

Hello.

I could recall a similar thread. I''m going to attach to this thread a sample db implementing the solution.
The solution (based on table outer join) has an advantage that new records actually are being created only upon entering data - where is no need to clear unused entries after user input.

The code was preliminary tested only so I could not guarantee it 100% robust.

Regards,
Fish

Attached Files
LJ Form.zip (77.6 KB, 58 views)


I''m afraid that my db is a bit more complicated .the main form has seperate fields A, B, C , D when each field has a dropdown list with choice of 1,2,3,4 options and each option 1,2,3,4, has allocated Vcodes .
The idea is to have all Vcodes in one subform when chosing the options from main form.ehh knew it would be hard to explain...


I''m afraid that my db is a bit more complicated .the main form has seperate fields A, B, C , D when each field has a dropdown list with choice of 1,2,3,4 options and each option 1,2,3,4, has allocated Vcodes .
The idea is to have all Vcodes in one subform when chosing the options from main form.ehh knew it would be hard to explain...

The example shows a general approach to create record slots using table outer join on 3 table many-to-many relationship. I''m sure your db is bit more complicated. ;) Regardless that I''m not sure it couldn''t be used in your case.

Your explanation will make more sense if you post metadata for all relevant datasets.
Here is an example of how to post table MetaData :
Table Name=tblStudent

Expand|Select|Wrap|Line Numbers


这篇关于在子表单-vba代码中生成记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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