protect field data from deletion

ckiley

Registered User.
Local time
Today, 17:23
Joined
Sep 15, 2005
Messages
10
I created a form for project tracking. The form has a project name field in it that is a required field. The manager fills that out first, but may go back later to fill in additional data. I created a button to allow them to search for a project name, but they keep opening the form and typing in the project name they want to search for in the project name field of the first record that appears. This changes or deletes the project name for the record they typed in. Is there a way to prevent them from typing in that one field after a project name is initially entered?
 
Go to properties on the Project Name field. Make the following changes:

Enabled - No
Locked - Yes

This will "lock" the project name in the field and not allow edits.

You could also use a combo or list box for the Project Name field called from a table that just contains the name of the projects.
 
Would that prevent them from entering new project names for new projects?
 
You need to add the functionality that checks if a record has been altered [is dirty] and warn the user that the current rcord has been modified and that they need to either save their changes by clicking a custom save button or undo their changes.

All verification code should be placed in the forms BeforeUpdate event.

Check out these two links for working examples on how to do it...

A better mouse trap? Another twist on how to prevent a modifed record from being saved unless the user clicks a custom Save button.

Enable/Disable The Control Box X Button The form named "fTestCancelFromUnloadEvent" in the Enable/Disable The Control Box X Button sample db will demonstrate how you can prevent a user from closing a form and also the application unless they do exactly what you want them to do.
 
How about something like this in the oncurrent event of your form?

Code:
If IsNull(Me.YourProjectNameControl) Then
Me.YourProjectNameControl.Enabled = True
Else
Me.YourProjectNameControl.Enabled = False
End If

You will have to set the enabled value of YourProjectNameControl to no

If there is a project name already entered the control will be dim else it will accept input. You could also use the locked value in place of enabled.

I would suggest using ghudsons better mousetrap too!
 
Last edited:
Thanks! looks like I have a couple of solutions now!
 

Users who are viewing this thread

Back
Top Bottom