Are you sure? on Edit (1 Viewer)

Ak01

New member
Local time
Yesterday, 21:28
Joined
Jun 21, 2019
Messages
3
Hi

Using 2016.

Sorry but I am new Access user.

When I have colleagues entering data into a freeform field, I want them to have an OK/cancel option, where they can read back the edit before submitting to the database.

How please

Ak
 

Micron

AWF VIP
Local time
Today, 00:28
Joined
Oct 20, 2018
Messages
3,478
If this is just going to be just one field, then you could use the BeforeUpdate event for the control on the form, and present a message box that would arise when the user does anything that would attempt to commit that update. The user response either allows that field to be updated or to cancel the update. The question is, what then? This quest sort of dances around the issue of creating or editing records, because there are updates to controls, then there are updates to records. You could conceivably create a record in spite of canceling the update of any given control. This might be one of those things that will require you to be very specific about how you see this all working - which can be a challenge if you don't know what it is you don't know.


Crikey - was going to mention that a macro might be more conducive to your needs, but I don't use them as a rule. Maybe a code solution isn't what you're looking for.
 
Last edited:

Ak01

New member
Local time
Yesterday, 21:28
Joined
Jun 21, 2019
Messages
3
Your patience is appreciated.
Before update seems like an option.
To clarify, I simply want the user, on a specific free form text field, to read back to themselves the entry they are making, before they commit it to the database. For example , we may have a "notes" field, to which they want to add a random comment such as "client takes ages to answer the phone so let it ring for ages" - I am not going to set up validation rules; a drop down list; or separate table, for such random "notes" - instead I would like users to check the entry before committing it.
If I go to property sheet and select "before update" what next? an MS built in Macro builder?
Thanks
 

Micron

AWF VIP
Local time
Today, 00:28
Joined
Oct 20, 2018
Messages
3,478
If the reason for this is because it is possible for the text to exceed what can be seen in the control, then a zoom box for the control might be better. Otherwise, in form design view, select the control and click on ... in property sheet event tab for this control for Before Update event. When code window opens, between Private Sub...and End Sub enter

Code:
Dim result As Integer

result = Msgbox ("Commit this entry?",vbOkCancel, "CONFIRM ENTRY")
If result = vbCancel Then Me.NameOfYourTextboxHere.Undo
The numerical values for OK and Cancel are 1 and 2 respectively IIRC, so you could use 2 instead of vbCancel. Mostly I use the numbers so I might be wrong about vbCancel. Research message box function if you want to know what all the options are.

However, as I mentioned, this may not work as you require because there is Undo for a control and a form, and the results are different. The above will only cancel a field change and won't have any effect on whether or not the record will be saved. Nor will it stop any other user action from taking place. What I didn't do is stipulate what happens if the entry is canceled as I don't know what that should be. To be honest, I don't think the whole idea will provide much in the way of user contemplation. Such messages quickly become mundane, thus glossed over.

https://docs.microsoft.com/en-us/office/vba/api/access.textbox.undo(method)


From the link it should be apparent that it is also possible to undo an entire form if you wish.
 

Users who are viewing this thread

Top Bottom