Discussion Locked

Access 97 Form locking after data entry

0 helpful
7 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have created a form that is filled out by users. Information from the form is saved to a table.

When the form is started it needs to be parially filled out, then at a later time completed, closed out and locked.

Once the final field is filled out the form needs to be locked and not editable.

All forms that do not have the final field filled out should be available for viewing until the final field is filled out.

I would gratly appreciate it if you could help me solve this prolem.

Thank you!

7 replies

by stillatit

Add a field for record status to the database definition. When you create a new record, your form fills in an initial.

When a user fills in the last field and closes out the record, change the status. (You probably want to make sure that the record passes all of your validation checks before you turn on the lock field.)

When you read in a record, check the status. If it shows the record closed out, disable editing on all fields of your form. If not, enable fields on the form. (You need that second decision fork, so that moving from a locked record to an unlocked record works correctly.)

Good luck.

by donq

Your need is quite simple and the solution will take a little thought. Place a "Close" button on the form that in reality calls a procedure "SubCheckForDone()" then have the procedure check each field for "Not Null" to insure the user entered something. For the fields needing a start-up value provide it under "Default Value" but reolize the field will never be Null for checking.

At the end of SubCheckForDone() close the form if there are no nulls, or show a "Msgbox" for eaxh Null and request the required value and exit SubCheckForDone().

by sankulpune

Hello udilevy,

Try following code to lock the record after entry in the final field.

'------
Private Sub Form_Current()
Application.Echo False
Dim x As Integer, k As Integer
x = Me.Controls.Count - 1
For k = 0 To x
If TypeName(Me.Controls(k)) <> "Label" Then
' You may need to add similar condition for
' other controls on your form that do not
' have the enabled property.
Me.Controls(k).Enabled = True
End If
Next k
If Len(FimalField) > 0 Then
For k = 0 To x
If TypeName(Me.Controls(k)) <> "Label" Then
Me.Controls(k).Enabled = False
End If
Next k
End If
Application.Echo True
End Sub
' ------

The only hitch, it may not be very pleasing to the eye.

I have tried this code successfully and would be happy to help you implement it.

Your early response will be highly appreciated.

With best personal regards,

SanganakSakha,
Your Friend In Need.

This discussion is closed to new replies.