【问题标题】:Vba want user to force fill form when not filled programme should not continue futherVba希望用户在未填写程序时强制填写表格不应继续
【发布时间】:2016-03-23 18:28:10
【问题描述】:

我有一个用户应该填写的表格,如果某些字段没有填写,表格不应该继续,但它仍然可以,可能是我没有看到一些帮助

这是在按下的按钮下 If Me.cbTyreNsf.value = " " Then

    MsgBox "You must complete the Wheel Nsf value", vbCritical
    Exit Sub

End If

If Me.cbTyreNsR.value = "" Then

    MsgBox "You must complete  Wheel Nsr value", vbCritical
    Exit Sub
End If

the function called
 Call CheckifRecordExistOnWheelTable

函数的代码 选择案例 avar 案例“空” 调用 insertWheel 其他情况 调用 updateWheel 结束选择

以及函数调用的函数代码

 nssf = Me.cbTyreNsf.value

Select Case nssf
Case "0"
    MsgBox " Please enter the NSF tyre value", vbCritical
    Me.cbTyreNsf.SetFocus
   ' MsgBox "about to exit"
    Exit Sub

Case Else
    nsf = CInt(nssf)
End Select

任何帮助,我已经用了 24 小时数着尝试了每一件事

【问题讨论】:

    标签: excel vba excel-2010


    【解决方案1】:

    这可能是个问题:

    nssf = Me.cbTyreNsf.value
    

    如果 cbTyreNsf 中没有值,它不会将任何值传递给 nssf。 (此时尝试 msgbox(nssf)。它会给你空白消息框)。如果您想使用当前的选择案例对其进行测试,那么您可以尝试检查值的长度,对于空 cbTyreNsf,该长度将为 0。

    nssf =Len(Me.cbTyreNsR.value)
    

    【讨论】:

    • 我期待一个整数
    猜你喜欢
    • 1970-01-01
    • 2018-07-13
    • 1970-01-01
    • 2012-11-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-03
    • 2011-03-29
    相关资源
    最近更新 更多