lock fields in a form when showing old records

EzIA

Registered User.
Local time
Today, 14:54
Joined
Sep 27, 2009
Messages
10
Hi
I have a form which is used to take-in orders.
The form is being used to add new records but also to edit records made in the last 2-3 days.
I need to somehow not allow users to make changes to info in records older than that and only allow viewing of the info via the form.

I coudlnt find anything clear about how to do that though I think this to be something lots of ppl use/would need.

thanks
E.Z.
 
If you want help you've really got to be clearer in your stated needs. Is it 2 days or 3 days? And by days do you simply mean that on Friday you want to lock records from the previous Tuesday and before (for 3 days) or do you mean 72 hours previously and before? And most importantly, do you have a date field on each record for when the order is taken in?
 
ok....I will try to be clearer
I have a field for when the record is taken.
For the purpose of this discussion lets say I want to lock all records older than 3 days.
By 3 days I mean the most flexible definition (On Friday block Tuesday and older) and not exactly 72 hours.
The purpose is to let users view all orders and edit only current orders from the last 3 days but block any changes that they might mistakenly edit in fields of "old" records
 
Okay! This is all you need:
Code:
Private Sub Form_Current()
 If DateDiff("d", Me.YourDateField, Date) > [B]3[/B] Then
  Me.AllowEdits = False
 Else
  Me.AllowEdits = True
 End If
End Sub
Simply replace YourDateField with the actual name of your textbox that holds the order date. You can change the number of days by simply changing the 3 to whatever you want.

Good luck with your project!
 

Users who are viewing this thread

Back
Top Bottom