Locking Fields

D

DMH

I have a form that returns records based on a combo box selection. I have a
field (open\close) that indicates whether the record is open or closed. The
open\close field requires a password before it will update.

My problem is when a user displays the form, I want all the fields, except
the search field locked if the incident is closed or unlocked if the incident
is open. The user may also update the open\close field after displaying the
form so I would need it to lock or unlock the fields at that time as well.

Can anyone point me in the right directions as to how to set this up?
 
R

Ryan

I would use the On Current event to Enable or disable the field. The code
for the On Current event would look something like this.

Private Sub Form_Current()
If Me!OpenClosed = "Closed" Then
Me!yourfield1.Enabled = False
Else
Me!yourfield1.Enabled = True
End If

You would need to repeate this for each field on your form. Another aproach
would be to Case each field. That would look like this.

Private Sub Form_Current()
Select Case OpenClosed
Case "Closed"
Me!yourfield1.Enabled = False
Me!yourfield2.Enabled = False
Me!yourfield3.Enabled = False
Case "Open"
Me!yourfield1.Enabled = True
Me!yourfield2.Enabled = True
Me!yourfield3.Enabled = True
End Select
End Sub

Hope this helps. Please mark answered if this answers your question.
 
D

DMH

Thanks so much for your reply this website has been so helpful to me thanks
to people like you. I actually used the conditional formatting for each
control and it works like a charm now. I will store you code for future use
though.

Thanks again,
 

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