I have set a msgbox to display a warning if fields are missing, and i thought the code that i have in here would stop the data being inputted into the worksheet.
But.... It doesnt it still adds the data even if some fields are missing, what have i done wrong here? and what do i need to do to correct it?
'//Check for all required entries
If category.Value = "" Or customer.Value = "" Or category.Value = "Select" Or customer.Value = "Select" Or product.Value = "" Or product.Value = "Select" Or salespart.Value = "" Or salespart.Value = "Select" Or purchaseprice.Value = "" Or purchaseprice.Value = "Enter Price Here" Or casesin.Value = "Enter Value Here" Or casesin.Value = "" Or casesout.Value = "Enter Value Here" Or casesout.Value = "" Or salesprice = "" Or salesprice = "Enter Price Here" Or hemisphere.Value = "" Or Origin.Value = "" Or site.Value = "" Or supplier.Value = "" Or packagingtype.Value = "" Or ordertype.Value = "" Or cratesize.Value = "" Then
'//Notify user if entries are missing
MsgBox "Some Fields Are Missing, Please Check And Fill In Missing Entries", vbOKOnly + vbExclamation, "Warning! Input Error"
Dim cCtrl As Control
For Each cCtrl In Me.Controls
If cCtrl.Tag = "Must" Then
Select Case TypeName(cCtrl)
Case "TextBox"
If cCtrl = vbNullString Then
MsgBox cCtrl.Name & " is mandatory"
cCtrl.SetFocus
Exit Sub
End If
Case Else
'Whatver
End Select
End If
Next cCtrl
End If
Bookmarks