Read Only Record in a Table

ohappyday

Registered User.
Local time
Today, 03:57
Joined
Aug 6, 2009
Messages
20
I have a table "Work Logs" that contains fields pertaining to an employee's timesheet. The fields are (Analyst Name, Week, Status, Hours, etc). The table and fields are linked to a data entry Form " Tech Work Log" that allows the employee to submit their information.

After the employee searches for the Work Log for a particular week, how can I make the record 'Read Only' if the Status field in the Work Logs tables = "Approved"?

Thanks for your help!!
 
In the form's On Current event, put

Code:
Me.AllowEdits= Not (Me.Status = "Approved")
Me.AllowDeletions = Not (Me.Status = "Approved")
That is assuming that your control on the form is named Status.
 
Woohoo!! Thanks!

That worked perfectly!

Could I also use the same code on subforms that are related to the Main form by a field (Work Log ID)?

Thanks again for the quick response!!
 
I think you'll find that if the main form has its AllowEdits set to NO, that the subform will not be able to be edited either.
 
It will allow me to edit on the subforms, but it may be something I am doing wrong.

Thanks again for your help!
 
Well, you can put similar code in the subform's Current event, if you want to do it based on the other field.
 
I can? How do I reference the field on the other form?

Would I use the following code?
Me.AllowEdits= Not (FormName?.Status = "Approved")
Me.AllowDeletions = Not (FormName?.Status = "Approved")
 
Code:
Me.AllowEdits= Not ([COLOR="red"]Me.Parent.[/COLOR]Status = "Approved")
Me.AllowDeletions = Not ([COLOR="Red"]Me.Parent.[/COLOR]Status = "Approved")
 
Thanks!! It worked!!!
...I would have never figured that out.
:D
 

Users who are viewing this thread

Back
Top Bottom