Full Version: If the value of one combo box is null then another combo box is disabled
UtterAccess Discussion Forums > Microsoft® Access > Access Queries
ben2203
Sorry to be a pest,

I've asked this question before about three years ago but I've completely forgotten how to do it.

I have two combo boxes, lets say cbobox1 and cbobox2, I want cbobox2 to be disabled until cbobox1 has been completed with a value, I have a vague recollection of something like this but I'm not sure it's completely correct, the most obvious thing to do would be for me to try it but I wanted to ask the experts first, if that is ok?

if cbobox1.value = null

then

me.cbobox2.enabled = false

else

me.cbobox2.enabled = true

end sub

Thanks for your time
Larry Larsen
Hi

Look to use the On Current event of the form..

Try this:
CODE
If IsNull(Me.ComboName) Then
Me.cbobox2.enabled = False
Else
Me.cbobox2.enabled = True
End If

thumbup.gif
ben2203
thanks once again Larry
Larry Larsen
thumbup.gif
ben2203
Hi Larry,

Not sure, if you will still be following this thread but if you are or anybody else for that matter,

I'm not quite sure which event I will use for another instance where I will use a combos value to display a message to a user.

Basically a variation of the above:

Private Sub Form_Current()

If IsNull(Me.cboSelectSender) Then

Me.cbooutstanding.Visible = True

Else
Me.cbooutstanding.Visible = False

End If

End Sub

so a label (though I've labelled it cbooutstanding) will be displayed if there isn't any data inside the cboselectsender list
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.