文本字段数据输入验证 [英] Text field data entry validation

查看:86
本文介绍了文本字段数据输入验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用MS Project 2010并使用自定义文本(和其他)字段进行数据集成。我们正在将MSP 2010的任务数据集成到我们的其他财务应用程序中,文本字段在此集成中发挥作用。在其中一个
文本字段(比如Text15)中,我们需要让项目经理输入在每个项目中对每个任务都是唯一的值。这些值对于每个项目都是不同的,并且没有标准集,因此我们无法构建查找集。现在我们需要确保
在用户保存数据之前明确点击保存,用户输入了Text15的值,并且每个任务的值都是唯一的。如果用户未输入值或值不唯一,我们需要向用户显示消息。
我们如何实现这一目标?

We are using MS Project 2010 and making use of the custom text (and other) fields for data integration. We are integrating the task data from MSP 2010 into our other financial application and the text fields play roles in this integration. In one of the text fields (say Text15), we need to have project managers enter values that, within each project, are unique for each task. These values are different for each project and there is no standard set so we cannot build a lookup set. Now we need to ensure that before the user saves the data by explicitly clicking on save, user has entered value for Text15 and the value are unique for each task. If the user has not entered the values or values are not unique, we need to display message to the user. How do we achieve this?

推荐答案

Sam,

你最好的选择是简单的VBA宏,用于检查Text15字段的唯一条目。您可以指示用户在编辑过程中运行审核宏,或者您甚至可以将其设置为自动触发保存事件。

Your best option for this is a simple VBA macro that examines the Text15 field for unique entries. You could instruct users to run the audit macro as part of their editing process or you could even set it up to automatically fire on the Save Event.

更新:此宏应该执行您需要的操作。它假定摘要行上的Text15不需要输入。如果不是这样,您可以轻松修改代码以包含汇总行条目。

Update: This macro should do what you need. It assumes no entries are necessary for Text15 on summary lines. If that is not true you can easily modify the code to include summary line entries.

这是代码的简单版本。可以通过在结尾存储所有缺失和重复的显示或打印输入条目,或者将它们打印到即时窗口来增强它。这是一个更复杂的问题。

This is a simple version of the code. It could be enhanced by storing all missing and duplicate entries for display or printout at the end, or printing them to the immediate window. It's all a matter of a little more sophistication.

John


这篇关于文本字段数据输入验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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