Field control lock

  • Thread starter Thread starter Annette
  • Start date Start date
A

Annette

I have a form that allows for entry of asset information. When
entering a record, I would like the user to be able to enter all the
data including original cost, date acquired and life span. Once this
data is entered, I would like a user to have to enter a password in
order to change the data.

I thought I could have the field locked and then have this in the
control's double click event:
If InputBox("Enter Password") = "admin" Then
Me![OriginalCost].Locked = False
End If

Followed by this in the control's exit event:
Me![OriginalCost].Locked = True

This works great when data is already entered, but I don't want the
user to have to do this when entering a new record.

Any suggestions?
 
Add NewRecord

Private Sub Form_Current()
If Me.NewRecord = True Then
Me.OriginalCost.Locked = False
Else
Me.OriginalCost.Locked = True
End If
' can use
' Me.OriginalCost.Locked = Not Me.NewRecord
' instead
End Sub

HTH

Pieter
 
When
entering a record, I would like the user to be able to enter all the
data including original cost, date acquired and life span. Once this
data is entered, I would like a user to have to enter a password in
order to change the data.

Why roll your own security? ANSI-92 Query Mode DCL syntax:

REVOKE DELETE, UPDATE ON MyTable FROM ApplicationUsers;
GRANT DELETE, UPDATE ON MyTable TO AdminUsers;

Jamie.

--
 

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

Back
Top