试图创建一个可选的灰色字段...... [英] Trying to create an optional greyed out field...

查看:61
本文介绍了试图创建一个可选的灰色字段......的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


所有这些都是新手,所以请耐心等待,如果可以的话请帮助我们!


我''我使用Access 2002 SP3为慈善机构创建数据库,我有一个名为会员数据的表单。在表格中我有两个字段:


就业?和就业细节。


就业?是或否,是从名为Employed.EmployedDetail的表中提取的。


我想要发生的是就业细节。表单上的字段是灰色的,直到就业?。设置为是。如果就业?设置为否,然后框保持灰色。


我已在就业详细信息下填写否。


我右键点击了雇用?字段,进入了构建事件>设计视图中的代码生成器并输入以下代码:

Hi everyone,

total newbie to all of this so please bear with me and help if you can!

I''m creating a database for a charity using Access 2002 SP3, I have a form called "Member Data". Within the form I have two fields:

"Employed?" and "Employment Details".

"Employed?" is either Yes or No and is pulled from a table called Employed.EmployedDetail.

What I would like to happen is the "Employment Details" field on the form is greyed out, untill "Employed?" is set to Yes. If "Employed?" is set as No, then the box stays greyed out.

I''ve put No in Enabled under "Employment Details".

I''ve right-clicked on the field "Employed?", gone to Build Event > Code Builder in the Design View and entered this code:

展开 | 选择 | Wrap | 行号

推荐答案


大家好,


所有这些都是新手,所以请耐心等待,如果可以的话请帮忙!


我正在使用Access 2002 SP3为慈善机构创建数据库,我有一个名为会员数据的表格。在表格中我有两个字段:


就业?和就业细节。


就业?是或否,是从名为Employed.EmployedDetail的表中提取的。


我想要发生的是就业细节。表单上的字段是灰色的,直到就业?。设置为是。如果就业?设置为否,然后框保持灰色。


我已在就业详细信息下填写否。


我右键点击了雇用?字段,进入了构建事件>设计视图中的代码生成器并输入此代码:

Private Sub Employed_BeforeUpdate()


如果已雇用。[Employed Detail] =" Yes" ;然后

就业详情。可观=真


如果就业。[就业细节] ="否"然后

就业详情。可见=假


结束子



这不是工作,但我知道它应该是这样的,如果有人可以帮我这个代码然后我真的很感激它!


非常感谢,

Tony
Hi everyone,

total newbie to all of this so please bear with me and help if you can!

I''m creating a database for a charity using Access 2002 SP3, I have a form called "Member Data". Within the form I have two fields:

"Employed?" and "Employment Details".

"Employed?" is either Yes or No and is pulled from a table called Employed.EmployedDetail.

What I would like to happen is the "Employment Details" field on the form is greyed out, untill "Employed?" is set to Yes. If "Employed?" is set as No, then the box stays greyed out.

I''ve put No in Enabled under "Employment Details".

I''ve right-clicked on the field "Employed?", gone to Build Event > Code Builder in the Design View and entered this code:

Private Sub Employed_BeforeUpdate()

If Employed.[Employed Detail] = "Yes" Then
Employment Details.Visible = True

If Employed.[Employed Detail] = "No" Then
Employment Details.Visible = False

End Sub


This isn''t working, but I know it should be something like this, if anyone can help me with this code then I would really appreciate it!

Many thanks,
Tony



你需要2个地方的代码来完成你想要的事情,在就业领域(chkEmployed)的AfterUpdate()事件和Current()中表格的事件,放置相同的代码。 (仅显示AfterUpdate()事件)。希望这会有所帮助:

You would need code in 2 places to accomplish what you want, In the AfterUpdate() Event of the Employment Field (chkEmployed), and in the Current() Event of the Form, place this same code. (Only the AfterUpdate() Event is shown). Hope this helps:

展开 | 选择 < span class =codeDivider> | Wrap | 行号


或者:

Or alternatively:

展开 | 选择 | Wrap | 行号



或者:

Or alternatively:

展开 | 选择 | Wrap | 行号


这篇关于试图创建一个可选的灰色字段......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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