Disable Double Click Event When Checkbox is Checked


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
 
Ad

Advertisements

S

SusanV

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

Guest

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
 
E

eric.nguyen312

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?
 
Ad

Advertisements

G

Guest

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.
 

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