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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disabling edit on selected records only 1

Status
Not open for further replies.

TerryEA

Technical User
Jun 20, 2004
99
GB
Can anyone tell me the simplest way to disallow edits on just some of the records displayed in a form.

For example, I wish to allow users to continue to enter and edit transactions in a form which records employees start times and end times, amoung other things. The process is operated by week nos. So what I want to do is to make sure that no-one can change or delete week 1 records once we are past, say, week 2 but they still have to be able to view them and indeed add new records each week.

Can I flag finished weeks and use that as a means of disallowing edits. Would appreciate suggestions.

Tel
 
What dictates week one, week two etc..? This becomes your criteria stament. I used, If textbox Week1, is less than
todays date, then... just so you get the idea. If you need help with the if statement, please let me know, how to diffrentiate Week 1, from week 2 ...week 3 etc..

Use Current event of form

Private Sub Form_Current()

If Week1 < Date Then Me.AllowDeletions = False Else Me.AllowDeletions = True

Good Luck!
 
Hi dboulos

I think this points me in the right direction. The week no field is numeric. Users might enter time sheet transactions for different dates, even across 2 or 3 weeks. So they either enter the date or select it from a list which comes from a sort of calendar table I set up. So once the date is entered, the form knows the week no concerned. The calendar also stores the week-ending date for each week so I guess I can use that in the way you suggest. Say, if Week_end_date < (Date - a preset no of days) Then
Me.AllowDeletions = False.

Presumably I can also do: Me.AllowEdits = False. Also, I wasn't sure which event to use so that's great.

I think this is the solution. Many thanks for the speedy and helpful reply.

Tel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top