Combo Box not null

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Does anyone know how to write code that will check values in a combo box and
that will display an error message if the there is combo box is blank?
 
If IsNull(Me.[CombName]) Or Me.[CombName]="" Then
MsgBox "Combo empty"
End If

if you want to check the value before the record is saved, then add this
code in the BeforeUpdate event of the form and add to it
If IsNull(Me.[CombName]) Or Me.[CombName]="" Then
MsgBox "Combo empty"
Cancel = True
End If
 
You can do that check in one step:

If Len(Me.[CombName] & "") = 0 Then

or

If Len(Me.[CombName] & vbNullString) = 0 Then

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Ofer said:
If IsNull(Me.[CombName]) Or Me.[CombName]="" Then
MsgBox "Combo empty"
End If

if you want to check the value before the record is saved, then add this
code in the BeforeUpdate event of the form and add to it
If IsNull(Me.[CombName]) Or Me.[CombName]="" Then
MsgBox "Combo empty"
Cancel = True
End If

--
\\// Live Long and Prosper \\//
BS"D


nir020 said:
Does anyone know how to write code that will check values in a combo box
and
that will display an error message if the there is combo box is blank?
 
Back
Top