locking off a form

K

Kazlou

I have a section in a database for the evaluation of a supplier that is
completed by the appropriate manager. How do I give them the ability to
complete the form, save it, go back to it and make adjustments, then when
finally happy confirm it and lock the form from any further changes?

thanks
karen
 
K

Keith Wilby

Kazlou said:
I have a section in a database for the evaluation of a supplier that is
completed by the appropriate manager. How do I give them the ability to
complete the form, save it, go back to it and make adjustments, then when
finally happy confirm it and lock the form from any further changes?

thanks
karen

Put a Boolean field into your table and name it "ReadOnly". Put a hidden
check box called "chkReadOnly" on your form and bind it to your Boolean
field. Put a "commit" command button called "cmdSubmit" on your form and
put this code in its click event:

If MsgBox("You won't be able to edit your responses once they are
committed - continue?", vbYesNo, "Confirm commit") = vbYes Then
Me.chkReadOnly = -1
Me.Refresh
Call Form_Current
End If

Then in your form's Current event:

If Me.chkReadOnly Then
Me.AllowEdits = False
Me.cmdSubmit.Enabled = False
Else
Me.AllowEdits = True
Me.cmdSubmit.Enabled = True
End If

That should do it, although you might want to add some code to check that
the user has fully completed the task before submission.

Keith.
www.keithwilby.co.uk
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top