Protect certain records

Dave Titan

Registered User.
Local time
Today, 07:30
Joined
Jan 1, 2002
Messages
69
Hey folks,

I've a form containing info based on a couple of tables. There are 250 records. I need to protect records 1 -45 from any changes. or even just the adddress fields in 1-45. But leave 46-250 so others can make changes, or even add new records.

Any Ideas???
 
You can use some code in the Before Update event of the form to prevent saving changes to those records. This will however, allow people to make changes to the record on screen, but you can stop them from saving them. This will only work on the form, not at the table level.
 
But won't that effect all records?
 
You can check the record number in the Before Update event before you cancel the save.
 
Thanks. Ok I will give this a go. I don't thinking my coding is up to scratch enough to make this a major success though. Any idea of where a sample may be?
 
What field as you using as the record number? Let's assume it's the "ID" field and that the control on the form is called "txtID". Here's some sample code:

Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
    If Me.txtID > 0 And Me.txtID < 50 Then
        Cancel = True
    End If
End Sub
 
cheers, thanks for that I will work on it now and let you know tomorrow the outcome.


Thanks again
 

Users who are viewing this thread

Back
Top Bottom