Protecting against accidental edit?

F

flint

I need people to have access to my form to review, edit and add
records. However, it's just too easy to accidentally change something.

Is it possible to add a control i.e. when anything changes to have a
confirmation dialog requiring a secondary action to confirm that the
change is intended. Like "Are you sure you wish to change this data?"

Thanks

Flint
 
S

Steve Schapel

Flint,

Yes. On the Before Update event of the form, you can put code like this...

If MsgBox("Are you sure?", vbQuestion + vbYesNo, "Confirm") = vbNo Then
Cancel = True
Me.Undo
End If
 
F

flint

Flint,

Yes. On the Before Update event of the form, you can put code like this...

If MsgBox("Are you sure?", vbQuestion + vbYesNo, "Confirm") = vbNo Then
Cancel = True
Me.Undo
End If

Hi Steve,

Thanks for the quick reply and I'm pleased to hear that what I need is
possible.

However, I'm not sure how to implement your suggestion. I have looked
in the help to see if I can see reference to the "Before update event"
but it just gets even more confusing! Sorry to ask but can you give a
brief idiot's guide please? :)

What do I need to do?

Flint
 
S

Scott McDaniel

Hi Steve,

Thanks for the quick reply and I'm pleased to hear that what I need is
possible.

However, I'm not sure how to implement your suggestion. I have looked
in the help to see if I can see reference to the "Before update event"
but it just gets even more confusing! Sorry to ask but can you give a
brief idiot's guide please? :)

What do I need to do?

To add the code Steve provided to your Form's Before UPdate event, open the form in Design view, then click the Events
tab on the Properties dialog ... find the Before UPdate event, and select [Event Procedure] from the dropdown. Access
will load the VB Edit window, and will create the Before Update's header and footer, something like this:

Sub Form_BeforeUpdate(Cancel As Integer)

End Sub

You then would place the code Steve provided between the "Sub" and "End Sub" lines ... Access will then fire this code
each time before the form updates the data ...

Scott McDaniel
scott@takemeout_infotrakker.com
www.infotrakker.com
 
S

Steve Schapel

A small edit, Scott...

Scott said:
To add the code Steve provided to your Form's Before UPdate event, open the form in Design view, then click the Events
tab on the Properties dialog ... find the Before UPdate event, and select [Event Procedure] from the dropdown.

Then you will need to click the ellipsis [...] to the right of the
property box.
 
F

flint

A small edit, Scott...

Scott said:
To add the code Steve provided to your Form's Before UPdate event, open the form in Design view, then click the Events
tab on the Properties dialog ... find the Before UPdate event, and select [Event Procedure] from the dropdown.

Then you will need to click the ellipsis [...] to the right of the
property box.
Access will load the VB Edit window, and will create the Before Update's header and footer, something like this:
Private Sub Form_BeforeUpdate(Cancel As Integer)
You then would place the code Steve provided between the "Sub" and "End Sub" lines ... Access will then fire this code
each time before the form updates the data ...

Thanks to you both.

Flint
 

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