0
我有一段代码来确保用户在输入“废品代码”时输入“废品量”。当我申请并使用Scrap1的代码时,一切都很好。当我尝试在下一组变量名中应用相同的代码时,我得到一个错误,说我的代码“检测到一个模糊的名字,我检查了我的变量名和代码,直到我的眼睛流血为止。 。有没有人看,我已经错过了一个错误在Access 2013中调试if语句
'check to see that there is a scrap amount if a code has been entered #1.
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.ScrapCodes1.Value Then
If Me.ScrapAmount1 = 0 Then
Cancel = True
MsgBox "If Scrap Code is selected, then Scrap Amount must have a value."
End If
End If
End Sub
'check to see that there is a scrap amount if a code has been entered #2.
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.ScrapCodes2.Value Then
If Me.ScrapAmount2 = 0 Then
Cancel = True
MsgBox "If Scrap Code is selected, then Scrap Amount must have a value."
End If
End If
End Sub
有您创建了两个'Form_BeforeUpdate'事件您只需要包含在ONE所有代码事件 – dbmitch
谢谢Dbmitch!修正了它!我应该知道的! – Flammie