如何根据另一个字段的值限制字段的值? [英] How do I restrict the value of a field based on the value of another field?

查看:88
本文介绍了如何根据另一个字段的值限制字段的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我正在学习Access的绳索,以便在我的研究项目中使用!

Hi guys, I'm currently learning the ropes of Access for use in my research project!

正如标题所示,我想知道如何限制价值一个基于另一个价值的字段?在我的项目中,其中一个问题是"该患者是否进行了MRI扫描?",查询表中的选项为"是"和"否"。接下来的问题
是"如果患者进行了MRI扫描,是否为阳性?"选项为"是","否","不可用(因为患者未进行MRI检查)"。是否存在限制输入的方法,如果第一个问题的答案为"否",则
的唯一有效选项是第二个问题"不可用"?或者是否会增加不必要的复杂性?

As the title implies, I am wondering how I can restrict the value of a field based on the value of another one? In my project, one of the questions is 'did this patient get an MRI scan?' with 'yes' and 'no' being the choices in a lookup table. The next question is 'if the patient got an MRI scan, was it positive?' with the options 'yes', 'no', and 'not available (as the patient did not get an MRI)'. Is there a way of restricting input such that if the answer to the first question is 'no', the only valid option for the second question would be 'not available'? Or is that adding unnecessary complexity?

提前感谢您的帮助!

推荐答案

您好,

这可以很容易地应用于表单而不是表级别。在表单上,​​您可以将第二个问题的默认值设置为"不可用"。当前一个问题的答案是"否"时,或者你可以限制
它给用户一个选择答案的选项。

This can easily be applied on a form and not so much at the table level. On a form, you can either set the default value of the second question to "not available" when the answer to the previous question was a "no," or you can restrict it to give the user an option to either select an answer or not.

在任何情况下,你都需要一些代码或宏来完成它。例如,您可以使用第一个问题的AfterUpdate事件来限制选项或指定"不适用"事件。到下一个问题。

In any case, you will need some code or macro to do it. For example, you can use the first question's AfterUpdate event to restrict the choices or assign "not applicable" to the next question.

希望它有所帮助...

Hope it helps...


这篇关于如何根据另一个字段的值限制字段的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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