ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,683
- Office Version
- 2007
- Platform
- Windows
Morning,
I have a userform where if i leave a ComboBox empty i see a MsgBox warning me that i must enter an invoice number.
It is this MsgBox i wish to remove so in future the user is able to leave it empty if they wish BUT should they enter an invoice number the code still must check if its beeing duplicated.
Please can you advise what i need to delete so i am able to leave the field empty but still check if the value entered is duplicated then advise me.
This is part of the code we need to edit.
I have a userform where if i leave a ComboBox empty i see a MsgBox warning me that i must enter an invoice number.
It is this MsgBox i wish to remove so in future the user is able to leave it empty if they wish BUT should they enter an invoice number the code still must check if its beeing duplicated.
Please can you advise what i need to delete so i am able to leave the field empty but still check if the value entered is duplicated then advise me.
This is part of the code we need to edit.
VBA Code:
Private Sub CommandButton1_Click()
With Sheets("DATABASE")
If Len(Me.ComboBox13.Text) = 0 Then
With Me.ComboBox13
MsgBox "You Must Enter An Invoice Number", vbCritical, "INVOICE NUMBER FIELD EMPTY MESSAGE"
.Value = "": .SetFocus
End With
Exit Sub
ElseIf Application.CountIf(.Columns(16), Me.ComboBox13.Text) > 0 And Not Me.ComboBox13.Text = "N/A" Then
With Me.ComboBox13
MsgBox "Invoice Number " & .Text & " Already Exists", vbCritical, "DUPLICATE INVOICE NUMBER MESSAGE"
.Value = "": .SetFocus
End With
Exit Sub
ElseIf IsNumeric(Me.ComboBox13.Text) Or Me.ComboBox13.Text = "N/A" Then