根据组合框选择启用子表单 [英] Enable subform based on combo box choice

查看:62
本文介绍了根据组合框选择启用子表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在查看基于组合框选项发生的事件的帖子,但没有一个真正触及我想要做的事情的核心。


我认为这很简单但我是新手,所以任何握手和不惊人的动作都会有所帮助。 :-)


我有一个带有下拉列表的Specimen,它按Species_Code显示Species。在物种表中,我有一个是/否字段,表明物种是否是鱼(是=鱼)。如果用户选择了一个Fish的Species_Code,我希望子窗体能够启用。


看起来这很简单,但我不知道VB(尽管我可以当我看到它时,请遵循它)并且我不确定在哪个事件上放置它或如何从Species表中绑定一个字段,该字段没有显示在子窗体的下拉列表中。那令人困惑吗?


基本上 - >如果用户为该记录选择了Fish = yes的Species_Code,那么subform.visible = true。


帮助!

Melissa

解决方案


我一直在查看基于组合框选项发生的事件的帖子,但没有一个真正触及我想要的内容我认为这很简单,但我是新手,所以任何握手和不惊人的动作都会有所帮助。 :-)


我有一个带有下拉列表的Specimen,它按Species_Code显示Species。在物种表中,我有一个是/否字段,表明物种是否是鱼(是=鱼)。如果用户选择了一个Fish的Species_Code,我希望子窗体能够启用。


看起来这很简单,但我不知道VB(尽管我可以当我看到它时,请遵循它)并且我不确定在哪个事件上放置它或如何从Species表中绑定一个字段,该字段没有显示在子窗体的下拉列表中。那令人困惑吗?


基本上 - >如果用户为该记录选择了Fish = yes的Species_Code,那么subform.visible = true。


帮助!

Melissa


我本来希望了解更多信息,但我会做一些基本的假设,例如:

__1你的组合框被命名为cboSpeciesCode。

__2您的物种表包含字段[鱼](是/否),[物种](文本)和[物种_代码](长)。

__3您的子表格名称是subfSpecies 。

__4根据需要进行任何其他调整。

__5在cboSpeciesCode的AfterUpdate()事件中:

展开 | 选择 | Wrap | 行号


抱歉!我应该指定这些东西。我做了适当的更改,但Species_Code是文本,而不是长整数。所以它似乎挂断了这一行:

展开 | 选择 | Wrap | 行号


更多信息:


组合框称为Species,Species表包含字段[Species_ID](自动编号,PK),[Species_Code](文本),[Common_Name](文本),[Family](文本),[Genus_ID] (autonumber,FK),[Scientific_Name](文本),[Alternate_Name](文本),[Fish](是/否)。


我是否需要将所有这些包含在代码?


子表单名称是sbfrm_FishSpecimen


这是我的意思将您建议的代码老化为:

展开 | 选择 | Wrap | < span class =codeLinkonclick =LineNumbers(this);>行号


I have been looking through posts on events happening based on a combo box choice but none really get at the heart of what I am trying to do.

I think this is simple but I''m a newbie so any hand holding and non-startling movements will help here. :-)

I have a form Specimen with a dropdown that displays Species by Species_Code. In the Species table I have a Yes/No field for whether or not the Species is a Fish (Yes = fish). If the user chooses a Species_Code that is a Fish I want the subform to become enabled.

Seems like this is pretty simple but I don''t know VB (though I can kind of follow it when I see it written) and am not sure on which event to put this on or how to tie a field from the Species table that isn''t being displayed in the dropdown to the subform. Is that confusing?

Basically --> If user chooses a Species_Code that has Fish = yes for that record then subform.visible = true.

Help!
Melissa

解决方案

I have been looking through posts on events happening based on a combo box choice but none really get at the heart of what I am trying to do.

I think this is simple but I''m a newbie so any hand holding and non-startling movements will help here. :-)

I have a form Specimen with a dropdown that displays Species by Species_Code. In the Species table I have a Yes/No field for whether or not the Species is a Fish (Yes = fish). If the user chooses a Species_Code that is a Fish I want the subform to become enabled.

Seems like this is pretty simple but I don''t know VB (though I can kind of follow it when I see it written) and am not sure on which event to put this on or how to tie a field from the Species table that isn''t being displayed in the dropdown to the subform. Is that confusing?

Basically --> If user chooses a Species_Code that has Fish = yes for that record then subform.visible = true.

Help!
Melissa

I would have liked a little more information but I''ll make some basic assumptions such as:
__1 Your Combo Box is named cboSpeciesCode.
__2 Your Species Table contains the Fields [Fish] (Yes/No), [Species] (Text), and [Species_Code] (Long).
__3 Your Sub-Form name is subfSpecies.
__4 Make any other adjustments as needed.
__5 In the AfterUpdate() Event of cboSpeciesCode:

Expand|Select|Wrap|Line Numbers


Sorry! I should have specified these things. I made appropriate changes but Species_Code is text, not a long integer. So it seems to be getting hung up on this line:

Expand|Select|Wrap|Line Numbers


More information:

Combo box is called "Species", Species Table has fields [Species_ID] (autonumber, PK), [Species_Code] (text), [Common_Name] (text), [Family] (text), [Genus_ID] (autonumber, FK), [Scientific_Name] (text), [Alternate_Name] (text), [Fish] (Yes/No).

Do I need to include all these in the code?

Subform name is sbfrm_FishSpecimen

Here is what I changed your suggested code to:

Expand|Select|Wrap|Line Numbers


这篇关于根据组合框选择启用子表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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