Making data Unchangable to user (1 Viewer)

dogman01

Registered User.
Local time
Today, 04:55
Joined
Dec 3, 2008
Messages
47
I have some users who input data into a form. They would like to have it so that once they have entered data into a field and move to the next field that the info they already entered into the previous field cannot be altered. Is this something that can be done?
 

SOS

Registered Lunatic
Local time
Today, 01:55
Joined
Aug 27, 2008
Messages
3,517
Set the AllowEdits to False in the form's On Current Event:

Code:
Private Sub Form_Current()
    Me.AllowEdits = Not (Len(Me.YourTextBoxNameHere & "") = 0)
End Sub
 

dogman01

Registered User.
Local time
Today, 04:55
Joined
Dec 3, 2008
Messages
47
That didn't seem to work. I can tell the form to Not Allow Edits and it works for a record that has already been entered but when i add a new record, fill data in a cell, move to another cell then come back to first cell - it still allows me to change the data. Don't want that.
 

SOS

Registered Lunatic
Local time
Today, 01:55
Joined
Aug 27, 2008
Messages
3,517
That didn't seem to work. I can tell the form to Not Allow Edits and it works for a record that has already been entered but when i add a new record, fill data in a cell, move to another cell then come back to first cell - it still allows me to change the data. Don't want that.
It really doesn't make sense to me that you can't edit something on a new record but that will be what it is until you save it. So, in the After Update event of EACH text box you would need to save the record.

If Me.Dirty Then Me.Dirty = False

then it should work.
 

Mr. B

"Doctor Access"
Local time
Today, 03:55
Joined
May 20, 2009
Messages
1,932
Even thought it is not something that may be as successful as you might think, (users make mistakes and need to make changes to data, even the data they just entered) you can prevent changes to the data in any control on you form by setting its "Locked" property to true.

Use the After Update event of the control and place code like the following:

If Not IsNull(me.NameOfControl) then
Me.NameOfControl.locked = true
end if

this will lock the specified control if it had any data.

Now, next question, how do they correct a mistake?

Just my thoughts!
 

MSAccessRookie

AWF VIP
Local time
Today, 04:55
Joined
May 2, 2008
Messages
3,428
I have some users who input data into a form. They would like to have it so that once they have entered data into a field and move to the next field that the info they already entered into the previous field cannot be altered. Is this something that can be done?

I think the "Data Entry" Property of a form will allow this. In that mode, the only thing that can be done is to add new entries. I am not sure if this is what you are looking for, but you can try it and see.
 

missinglinq

AWF VIP
Local time
Today, 04:55
Joined
Jun 20, 2003
Messages
6,423
Setting Data Entry to Yes only allows new records to be entered, but you can still return to a control withing a new record and change the data in it.

Having said that, it really makes no sense to not allow the data in any control to be changed once the control is exited! As has been said, mistakes frequently happen on entering data in a new record and will need to be corrected. Preventing correction while the record is still 'new' is going to lead to a huge headache, I suspect! What exactly is the rationale behind this request?
 

SOS

Registered Lunatic
Local time
Today, 01:55
Joined
Aug 27, 2008
Messages
3,517
It sounds almost like trying to do something like a spreadsheet application within Access.
 

Users who are viewing this thread

Top Bottom