Disable checkboxes if Combo is null (1 Viewer)

Sketchin

Registered User.
Local time
Yesterday, 21:41
Joined
Dec 20, 2011
Messages
575
Hi All,

I have a form with a combo and some checkboxes. What I want to do is disable the checkboxes for the rows where the checkbox is null. I would use something like
Code:
If IsNull (Me!CboContactID) then
 
Me!ChkWaitlist.Locked = True
Else
Me!ChkWaitlist.locked = False
End IF
I just dont know where to put this code, and if its the proper way to do it. I have included a jpg of my form which should clarify any confusion.

Thanks
 

Attachments

  • training Contacts.jpg
    training Contacts.jpg
    40.6 KB · Views: 90

boblarson

Smeghead
Local time
Yesterday, 21:41
Joined
Jan 12, 2001
Messages
32,059
If that's a continuous form, which it looks like it is, you can disable the checkboxes for the active row that is selected but that's it. You can't do them all because in essence it really is only one set of controls which the form makes it look like there are more than one set.

The code would go in the ON CURRENT event.
 
Last edited:

Sketchin

Registered User.
Local time
Yesterday, 21:41
Joined
Dec 20, 2011
Messages
575
It is a continuous form. My problem is if I check a box that has nothing in the combo, and then put focus elsewhere, I get an error "Index or Primary Key cannot contain a null value".

Is there any other fun way to get around this?
 

boblarson

Smeghead
Local time
Yesterday, 21:41
Joined
Jan 12, 2001
Messages
32,059
Set the checkbox's Enabled property to NO in design view and then set it to enabled in the Current event if there is a value in the combo ( If Len(me.ComboNameHere & vbNullstring) > 0 ) and also in the after update event of the combo.

That way it will be available if there is something already in the combo but won't be if not and then in the after update of the combo so when something is selected, it enables them.
 

Users who are viewing this thread

Top Bottom