Disable Double Click Event When Checkbox is Checked

  • Thread starter Thread starter eric.nguyen312
  • Start date Start date
E

eric.nguyen312

Hi,
I have a subform that has a double click event on a few textboxes that
opens up another form. What I want to do is disable that event if a
checkbox 'Job Closed' is checked on the form. Can someone please help
me on this?

Thanks,
Eric
 
You can disable the textboxes as follows in the form's On Current Event. You
might want to put this in the after update of the checkbox as well:

Me.textbox.enabled = (Me.checkbox = false)
 
You can code the DoubleClick event to not do anything if the check box is
checked:

Private Sub SomeTextBox_DoubleClick()
If Me.JobClosed = False Then
DoCmd.OpenForm "TheOtherForm"
End If
End Sub
 
You can code the DoubleClick event to not do anything if the check box is
checked:

Private Sub SomeTextBox_DoubleClick()
If Me.JobClosed = False Then
DoCmd.OpenForm "TheOtherForm"
End If
End Sub

Dave, thanks for the reply. I used the code above and i get a compile
error: method or data member not found. The error is with
'Me.JobClosed'. Am I getting this error because textbox is in the
subform?
 
Yes. I forgot about that part. This is going to be a bit awkward because if
the subform is a datasheet it may not work at all. If it is a continuous
form, you will have to be sure the correct record is the current record in
the subform for it to evaluate the check box correctly. But, in any case,
here is the syntax to refer to the control on the sub form:
If Me.SubFormControlName.Form.JobClosed = False Then

Now, be aware SubFormControlName is the name of the subform control on the
main form, not the name of the form that is the source object of the subform.
They can be (but should not be) the same.
 
Back
Top