Checkbox.enabled

  • Thread starter Thread starter Max
  • Start date Start date
M

Max

I have a checkbox that is enabled when the value of a combobox on the same
form is "Monthly". Below is the code. This works great except when the form
moves to past the end of the recordset (to a new record). I get an error
"Invalid use of null" What is the best way to avoid this error?

Form on current:
ckb_week1.Enabled = cbo_MeetingType.Value = "Monthly"
 
Try something along the lines of
If IsNull(cbo_MeetingType.Value) Then
ckb_week1.Enabled = whatever setting you want
ElseIf cbo_MeetingType.Value = "Monthly" Then
ckb_week1.Enabled = True
Else
ckb_week1.Enabled = False
End If

Hope This Helps
Gerald Stanley MCSD
 
Jeff,

Change your code to:

ckb_week1.Enabled = IIF(IsNull(cbo_MeetingType.Value), False,
cbo_MeetingType.Value = "Monthly")
 
Back
Top