表单上的显示按钮(连续)取决于记录 [英] Display Button on Form (Continuous) Depending on record

查看:52
本文介绍了表单上的显示按钮(连续)取决于记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个以连续形式显示的记录列表.我也在这种形式中放置按钮.

I have a list of Records that I am Displaying in a continuous form. I am also putting buttons in this form.

浏览器我在列表中有一个考试"列表,我有每个考试的按钮,例如删除按钮、编辑按钮等等.仅当考试具有特定变量集时,我才想添加另一个按钮.

IE I have a list of "exams" on the list I have buttons for each exam such as a DELETE Button, EDIT button and so forth. I want to add another button only if the exam has a certain variable set.

记录集示例

| Key | ExamName    | ExamLocation | ExamDate | ExamComplete |
|-----|-------------|--------------|----------|--------------|
| 1   | Test Exam 1 | TX           | 10/2/19  | Y            |
| 2   | Test Exam 2 | SC           | 10/4/19  | Y            |
| 3   | Test Exam 3 | AL           | 10/29/19 | N            |
| 4   | Text Exam 4 | WA           | 10/22/19 | Y            |

因此,对于为 ExamComplete 设置了Y"的每条记录,我想显示一个按钮,但不显示带有N"的记录

so for each on of the records that have a 'Y' set for ExamComplete, I want to display a button but not for those with a 'N'

我玩弄了onCurrent"和onLoad"事件但没有成功.

I have monkeyed with the "onCurrent" and "onLoad" event with no success.

示例代码

If me.ExamComplete.Value = "Y" Then
    Me.BtnClickOpen.visable = TRUE
ELSE
    Me.BtnClickOpen.visable = FALSE
END IF 

有什么想法吗?

推荐答案

在表单标题部分放置按钮.如果 ExamComplete 是 Yes/No 字段类型,则不要将参数放在引号内.无论字段类型如何,单行都是可能的 - 对于是/否,只需引用该字段.

Place buttons in form Header section. If ExamComplete is a Yes/No field type, don't put parameter within quote marks. Regardless of field type, a one-liner is possible - for Yes/No, just reference the field.

Me.BtnClickOpen.Visible = Me!ExamComplete

当然需要表单 Current event 中的代码,但也可能需要在 ExamComplete 复选框 AfterUpdate 中.

Certainly want code in form Current event but possibly also in ExamComplete checkbox AfterUpdate.

只有一个按钮,因此 VBA 设置属性会影响按钮的所有实例 - 每条记录都将显示相同的内容.它将在 Detail 部分工作,但可能会分散用户的注意力,并且所有按钮实例都消失/出现,使用户感到困惑.另一种方法是使用条件格式(无 VBA)的文本框来模拟详细信息"部分中的按钮.文本框将始终可见(除非规则更改背景颜色以匹配表单以使其融合)并按记录单独动态启用/禁用.

There is only one button so VBA setting property impacts ALL instances of button - each record will display the same. It will work in Detail section but can be distracting and confusing to user with all button instances disappearing/appearing. Alternative is textbox with Conditional Formatting (no VBA) to emulate a button in Detail section. The textbox will always be visible (unless rule changes background color to match form so it blends in) and dynamically enabled/disabled individually per record.

这篇关于表单上的显示按钮(连续)取决于记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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