Testing empty combo box

  • Thread starter Thread starter Chris Kennedy
  • Start date Start date
C

Chris Kennedy

I have a bound combo box which when you go to a new record is blank as it is
bound it is filled in on other record. When the new record on the form is
filled in I need to ensure something has been selected on the combo box. The
code I use is

If IsNull(Forms!frmInscriptions.cboCemetery.Value) = True Then
intvalidate = intvalidate + 1
strValidate = strValidate & " a cemetery "
End If

or also

If IsNull(Forms!frmInscriptions.cboCemetery.Value) Then
intvalidate = intvalidate + 1
strValidate = strValidate & " a cemetery "
End If

it doesn't return an empty value. Does anyone have any ideas? Regards,
Chris.
 
I have had a similar problem. Sometime I have had to check for an empty
string instead of a null value. I have never quite figured out the
difference.

Try this..

If IsNull(Forms!frmInscriptions.cboCemetery.Value) = True or
If Forms!frmInscriptions.cboCemetery.Value = ""

hth

Paul
 
Got it by testing for 0. Which is the default value of the field it is bound
to. Nevermind
 
or for an improvement on the second onem add the NZ function in case there
is a null

If nz(Forms!frmInscriptions.cboCemetery.Value) = ""
 
Back
Top