By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,474 Members | 3,214 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,474 IT Pros & Developers. It's quick & easy.

Locking Records

P: n/a
Hi.
Awhile back I got some useful advice in locking records using tick boxes. Eg
a field called 'Locked' was used to tick (yes/no format) any record in the
datasheet view.
But I would like to know how to do the same when a particular date field
(field name: 'File Date') is populated by the user.
Below is the example of the tick box method...wondering if anyone can modify
the method to my question. thanks.

Set the form's Allow Edits and Allow Deletions properties in the
Form_Current() event procedure.

Private Sub Form_Current()

With Me
.AllowEdits = Not Me.Locked
.AllowDeletions = .AllowEdits
End With

End Sub

Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
sonta wrote:
Hi.
Awhile back I got some useful advice in locking records using tick boxes. Eg
a field called 'Locked' was used to tick (yes/no format) any record in the
datasheet view.
But I would like to know how to do the same when a particular date field
(field name: 'File Date') is populated by the user.
Below is the example of the tick box method...wondering if anyone can modify
the method to my question. thanks.

Set the form's Allow Edits and Allow Deletions properties in the
Form_Current() event procedure.

Private Sub Form_Current()

With Me
.AllowEdits = Not Me.Locked
.AllowDeletions = .AllowEdits
End With

End Sub

What are you wanting to check/compare?

Here's a test that allows if date is null
With Me
.AllowEdits = IsNull([File Date])
.AllowDeletions = .AllowEdits
End With

Here's a test that allows if date is eaqual to today
With Me
.AllowEdits = ([File Date] = Date())
.AllowDeletions = .AllowEdits
End With

Nov 12 '05 #2

P: n/a
Hi Sonta,

(aircode)
Private Sub File_Date_AfterUpdate()

If Not IsNull(Me![FileDate]) Then 'Make sure that the user hasn't changed
thier mind

With Me
![Locked] = True 'You'll want to indicate that the record is now
locked.
.AllowEdits = Not Me.Locked
.AllowDeletions = .AllowEdits
End With

End If

End Sub

--
HTH,
Don
=============================
Use My*****@Telus.Net for e-mail
Disclaimer:
Professional PartsPerson
Amateur Database Programmer {:o)

I'm an Access97 user, so all posted code
samples are also Access97- based
unless otherwise noted.

Do Until SinksIn = True
File/Save, <slam fingers in desk drawer>
Loop

================================

"sonta" <sk**@optusnet.com.au> wrote in message
news:40**********************@news.optusnet.com.au ...
Hi.
Awhile back I got some useful advice in locking records using tick boxes. Eg a field called 'Locked' was used to tick (yes/no format) any record in the
datasheet view.
But I would like to know how to do the same when a particular date field
(field name: 'File Date') is populated by the user.
Below is the example of the tick box method...wondering if anyone can modify the method to my question. thanks.

Set the form's Allow Edits and Allow Deletions properties in the
Form_Current() event procedure.

Private Sub Form_Current()

With Me
.AllowEdits = Not Me.Locked
.AllowDeletions = .AllowEdits
End With

End Sub

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.