我有附加的用户表单。每当我点击“继续!”按钮时,我让它检查批次重量之和是否大于产品详细信息框中的第一个指定重量;
如果是,它要求我继续或不继续,我的答案是“是”,它继续,如果“否”,我希望它让我再次更改用户表单中的数量。
我已经写了下面的代码,但当我点击“否”的msgbox不断显示一次又一次:
Private Sub CommandButton1_Click() 'Proceed! Button
Dim answer As Integer
q = Val(Left(Label2.Caption, 5)) 'Weight in Product Details --> 15.12 tons
Total = BatchTotal1 + BatchTotal2 + BatchTotal3 + BatchTotal4 + BatchTotal5 'Publicly dimmed previously
Again:
If Total > q Then
answer = MsgBox("Batches total weight is more than you assigned first, Do you want to proceed?", vbQuestion + vbYesNo)
If answer = vbYes Then
GoTo Continue
Else
GoTo Again
End If
End If
Continue:
'Another code
1条答案
按热度按时间jucafojl1#
尽可能避免后藤。尝试以下操作: