Disable a record

J

Jade5

Hello: I am using Access 97 and I would like to disable a record when a
checkbox is clicked. My code below disables all the records in the form. How
can I delete only the record that is checked. The 3 fields in the form are
Type ID, Type code and Inactive. Inactive is a checkbox and the other two are
text fields. Thanks J.

Private Sub Inactive_Click()
If Me![Inactive] = True Then

Me![Type ID].Enabled = False
Me![Type code].Enabled = False

End If
End Sub
 
R

Rick B

You would have to put your code in the CURRENT event of the form which fires
as you move from one record to another. You'd also have to put it in the
CHANGE event of your "Inactive" field so that the fields will activate or
deactivate when the user changes the checkbox.
 
J

Jade5

Thanks Rick
I have put the same code in the CURRENT event of the form and also in the
click event of the Check box (there is no CHANGE event on this) but that
doesn't work.
J.
Rick B said:
You would have to put your code in the CURRENT event of the form which fires
as you move from one record to another. You'd also have to put it in the
CHANGE event of your "Inactive" field so that the fields will activate or
deactivate when the user changes the checkbox.

--
Rick B



Jade5 said:
Hello: I am using Access 97 and I would like to disable a record when a
checkbox is clicked. My code below disables all the records in the form.
How
can I delete only the record that is checked. The 3 fields in the form are
Type ID, Type code and Inactive. Inactive is a checkbox and the other two
are
text fields. Thanks J.

Private Sub Inactive_Click()
If Me![Inactive] = True Then

Me![Type ID].Enabled = False
Me![Type code].Enabled = False

End If
End Sub
 

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