From: John W. Vinson on
On Thu, 25 Feb 2010 05:50:02 -0800, Grasavong
<Grasavong(a)discussions.microsoft.com> wrote:

>The latter. When the 'record' has been completed..i.e. every field (or is it
>textbox) in that record has data and eventually moves on to another record.
>This is an internal database. There are going to be about 10 people that will
>use it. Believe me, no one is going to bother to take the time to bypass any
>type of security that is put on it.
>
>It's basically Access for dummies. I created the database table, designed
>the form, now I want the completed record to be a read-only document
>regardless if the user needs to go back and edit it. I know, it doesn't make
>sense and I personally don't agree with the idea myself but there's a reason
>why they want it this way (if possible).

Well... again, then, this is probably what you'll need: repeating my previous
post.

This can be done, but it's a bit of work. I presume that you want the user to
be able to enter some of the fields, close the form, go off and do something
else, open it up, add a few more fields, go to a different record and add some
fields, etc.... until all 28 fields (or however many) have been filled in? Do
you want the form to instantly lock up at that point, or just when the user
opens the form and navigates to it? The latter is simplest, if not very easy.

Open the form in design view. For each control that you want to count toward
"complete", set its Tag property to 1. Then in the form's Current event put
code like:


Private Sub Form_Current()
Dim ctl As Control
Dim bUnlock As Boolean
bUnlock = False
For Each ctl In Me.Controls
If ctl.Tag = 1 Then
If IsNull(ctl) Then
bUnlock = True
Exit For
End If
End If
Next ctl
Me.AllowUpdates = bUnlock
End Sub

This will loop through all the controls on the form (labels, rectangles,
lines, textboxes, etc.); if the control is a data-containing control with its
tag set, it will check to see if the control is empty; if there is ANY empty
control, the variable bUnlock will be True. If all of the controls have data
it will be False at the end of the loop. The form's Allow Updates property
will then be set to allow updates only if there is still at least one control
empty.
--

John W. Vinson [MVP]