Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Locking a completed entry.

Status
Not open for further replies.

Secretgeek

Technical User
Jan 3, 2008
80
GB
I've checked out other similar threads but haven't found anything that seems to match close enough.

Basically I have a subform that is used as a 'Status updates' notation area with each note occupying one record on the subform along with the status itself, the date and the user name of the person that created the note.

The date and user name are entered programatically and can't be changed.

My question is how do I stop amendments being made to the 'Status Notes' and 'Status' boxes once they have been entered.

Ideally the lock should only come into effect once the user leaves the main form as this would allow them to make changes if required e.g. spellchecking, amending etc.

I've got as far as knowing that this will have something to do with setting the 'Lock' property but I don't know how to distinguish between a new record and an existing one.

Thanks in advance for your help.
 
how to distinguish between a new record and an existing one.
Have a look to the NewRecord property of the Form object.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks PHV i've got off to a flying start. However the behaviour is slightly off.

My code currently is:

Private Sub Notes_Enter()
Dim intnewrec As Integer

intnewrec = Me.NewRecord
If intnewrec = True Then
Me.Notes.Locked = False
Me.Status.Locked = False
End If
End Sub

When you enter the status update form that has an existing record that record is locked however, when you then type a new update all the other entries become unlocked.

What i'm after is for only the new record on the form to be unlocked.

I'll have another think about this tomorrow.
 
In the Current event procedure of your status update form:
Code:
Dim intnewrec As Boolean
intnewrec = Not Me.NewRecord
Me!Notes.Locked = intnewrec
Me!Status.Locked = intnewrec

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top