Checkbox.enabled

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"
 
G

Gerald Stanley

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
 
P

PC Datasheet

Jeff,

Change your code to:

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top