Solved Text locked but textbox still editable? (1 Viewer)

Jolland26

New member
Local time
Today, 22:35
Joined
Sep 14, 2020
Messages
22
Hi guys, apologies if I'm posting this in the wrong part of the forum but I would like to have a textbox in my form where it saves the text input when the save button is clicked, but the textbox is still able to be edited by the next person looking at the form. Is this possible? For context in one of the other programs we use, when you input text into the textbox and then save, it greys the text out so it is visible to the next user for traceability, but not editable. I would like to emulate this but I can't find if it is possible or not.
Any help would be much appreciated!
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 05:35
Joined
May 7, 2009
Messages
19,245
you can add code to the save button to Lock the textbox:

private sub buttonSave_click()
DoCmd.RunCommand acCmdSaveRecord
me!textbox1.Locked = True
me!textbox2.Locked = True
end sub


private sub Form_current()
if me.NewRecord then
me!textbox1.Locked = False
me!textbox2.Locked = False
Else
me!textbox1.Locked = True
me!textbox2.Locked = True
end if
end sub
 

Jolland26

New member
Local time
Today, 22:35
Joined
Sep 14, 2020
Messages
22
you can add code to the save button to Lock the textbox:

private sub buttonSave_click()
DoCmd.RunCommand acCmdSaveRecord
me!textbox1.Locked = True
me!textbox2.Locked = True
end sub


private sub Form_current()
if me.NewRecord then
me!textbox1.Locked = False
me!textbox2.Locked = False
Else
me!textbox1.Locked = True
me!textbox2.Locked = True
end if
end sub

I don't think that will work, essentially I would like it to be the same record that is edited, but the text input the first time to not be able to be edited at the same time.
It seems to me that what I would like to do will not be possible using the same textbox, but creating a new textbox won't be ideal either.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 05:35
Joined
May 7, 2009
Messages
19,245
did you see the Other code (Form_Current).
it prevent editing (locked=true) of the textbox if
it is not a New record.
 

Jolland26

New member
Local time
Today, 22:35
Joined
Sep 14, 2020
Messages
22
Apologies, I'm not explaining myself very well.
Yes I did, but I would like to be able to put the text into the same textbox.
I'll give an example of what I'd like to do:
An engineer has to change a process. In doing so he has to give reasons for changing the process in the textbox txtResponse, which he does and saves the form.
During his investigation of the problem, he finds that he needs to change more of the process, so he goes back into the form.
txtResponse has his original response to the problem, but that text is greyed out from when he first saved the form, and is not editable. In the same textbox, txtResponse, underneath the greyed text he adds the new information about the extra changes and saves the form again.
This gives the traceability of what has been changed in the process.

I don't think this will be possible in access, but wanted to ask the forum before I completely wrote this idea off.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 05:35
Joined
May 7, 2009
Messages
19,245
here is a sample db.
 

Attachments

  • sampleLock.zip
    29.1 KB · Views: 136

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 05:35
Joined
May 7, 2009
Messages
19,245
on engineering thing, even on drawings, there is such a Revision number.
every new Revision is a New record to the db.
 

isladogs

MVP / VIP
Local time
Today, 22:35
Joined
Jan 14, 2017
Messages
18,239
You can lock the textboxes after data entry but add code to the Form_Load event to unlock them.
However it does seem convoluted. What if the engineer makes a mistake when the data is first entered?
Perhaps better to have a command button to unlock the controls again

Also if you use a bound form, the data is saved automatically.

Another thing...if you need to keep a log of changes made, you can use a column history feature but it only works with long text (memo) fields.
 

Jolland26

New member
Local time
Today, 22:35
Joined
Sep 14, 2020
Messages
22
here is a sample db.

Thanks for that, I understand what you mean now. It may work for the application I am designing, but I really want to make sure that nothing can be deleted or changed accidentally and remove the traceability.

You can lock the textboxes after data entry but add code to the Form_Load event to unlock them.
However it does seem convoluted. What if the engineer makes a mistake when the data is first entered?
Perhaps better to have a command button to unlock the controls again

Also if you use a bound form, the data is saved automatically.

Another thing...if you need to keep a log of changes made, you can use a column history feature but it only works with long text (memo) fields.

A log of changes made could be the way forward, as I am going to be using a long text field. A command button to unlock the text could be useful, but again I want to take the ability to edit exisiting records out of the users hands for security reasons.

I realise what I want to do is convoluted, like I said before I wanted to try and emulate the other program we use, but I don't think it will be possible to have it exactly the same.
 

Minty

AWF VIP
Local time
Today, 22:35
Joined
Jul 26, 2013
Messages
10,371
You are describing adding text to the existing text information. This is doable - but actually confusing, as I assume the original change data is DateTime stamped.
I would just have child table with the revision notes in - multiple records per main record, with a user and date time stamp.

Gives complete visibility of the history.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 05:35
Joined
May 7, 2009
Messages
19,245
make it simple, 1 record per revision (with revision number, that is the standard for any engineering field).
 

Jolland26

New member
Local time
Today, 22:35
Joined
Sep 14, 2020
Messages
22
You are describing adding text to the existing text information. This is doable - but actually confusing, as I assume the original change data is DateTime stamped.
I would just have child table with the revision notes in - multiple records per main record, with a user and date time stamp.

Gives complete visibility of the history.

I hadn't actually thought of that, I think this makes more sense than what I was originally trying to do anyway!

Thanks everyone for your help and for being so quick to reply!
 

Users who are viewing this thread

Top Bottom