如果对任何文档进行了更改后仍无法正确阅读 [英] If else not read properly after changes made to any document

查看:129
本文介绍了如果对任何文档进行了更改后仍无法正确阅读的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用的表单中有一个按钮.如果要检查是否在查看的文档列表中,如果"状态为锁定"的任何文档,则我将提示消息框首先完成PC检查!".所以

I have a button in a form where I'm using If else to check whether in list of document in view, "IF" any document with status "Lock", I will prompt messagebox "Complete PC Inspection First!". So

首先,单击按钮后,代码运行并且一切正常.然后,我尝试再次单击按钮而不进行任何更改,它将提示消息框.

At first, after the button is click, and code run and everything is working. Then I try to click the button again without made any changes it will prompt the messagebox.

但是,当我在任何文档中进行更改并将状态更改为其他状态(例如活动")时,我返回到表单并单击按钮,它不会提示消息,但是会跳过第一个如果"并继续执行别的.

But when I made a changes in any document and change status to others such as "Active", and I go back to the form and click the button, it not prompting the message, but it skip the first If and proceed to else.

下面是我的代码:

If doc.PStatus(0) = "Lock" Then
    Msgbox "Complete PC Inspection first!"
    Exit Sub
Else
    answer% = Messagebox("Do you confirm with this infomation?", 4,"Batch Number")
    Some code...
    ...
End If

我想做的是,如果视图中任何文档中的状态仍为锁定",则按钮将不会继续显示其他".当视图中没有锁定"状态时,它将继续其他".任何帮助将不胜感激.谢谢!

What I want to do is the button will not proceed to "else" if there still have "Lock" status in any document in the view. It will continue to "else" when there is no "Lock" status in the view. Any help will be appreciated. Thanks!

推荐答案

最好使用包含所有Locked文档的视图,该视图按PC密钥左右排序.或使用按键和状态排序的视图,这样您就可以挑选出特定PC的所有锁定文档.如果没有,GetDocumentByKey将返回Nothing.

Better use a view that contains all Locked documents, ordered by the PC key or so. Or use a view sorted by key and Status, so you can pick out all locked documents for a specific PC. If there aren't any, GetDocumentByKey will return Nothing.

这篇关于如果对任何文档进行了更改后仍无法正确阅读的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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