Confirmation-box after record update

C

Carsten Witt

Does Access 2000 not have any built-in feature to warn users if whenever a
record has been modified/updated ?

I am looking for a way to have a pop-up window to show up an say something
like :

"WARNING ! .....Record has been updated....click YES to confirm changes or
NO to cancel changes"


regards
Carsten
 
L

Luke Bellamy

Hi Carsten,
If a user has a record open through a form there is an event called
BeforeUpdate which triggers before any changes are made to each
record. This only occurs IF the user has actually modified the data in a
record. When this event is triggered you can show your warning message.
If they confirm the change you can just exit the routine but if they choose
to cancel you can call Me.Undo to rollback any changes they made.
Simply find the event in the list of properties for the form when opened
in design view.
Note that this does not apply to a multi-user environment where one
user makes changes and another user wishes to control the updating
of each record. But I don't think thats what your trying to achieve.

HTH
 
C

Carsten Witt

Luke

Thanks for your suggestion. I was aware of the BeforeUpdate parameter, but I
haven´t been able to figure our how how to make a script that does the job
for me when this BU is triggered.

Are you aware of what to do or maybe there is a site out there that has
collections of Access-scripts ?

regards
Carsten
 
L

Luke Bellamy

Carsten,
Are you after something like this:
*AIR CODE*

Private Sub Form_BeforeUpdate()
Dim strConfirmUpdate as Variant

' Gives the user a Yes/No option and sets the default to the 2nd button
which in this case is NO
strConfirmUpdate = MsgBox("WARNING ! .....Record has been
updated....click YES to confirm changes or NO to cancel changes", "My
Application Name", vbYesNo + vbDefaultButton2)

' If they do not wish to save changes then undo any made to this record
If strConfirmUpdate = vbNo then
Me.Undo
End If

End Sub

Please let me know if this is not what your after and I might
be able to point you in a better direction.
As for we sites that have code samples probably the
most well known site is http://www.mvps.org/access.

HTH
--
Luke Bellamy
Newcastle, Australia


Carsten Witt said:
Luke

Thanks for your suggestion. I was aware of the BeforeUpdate parameter, but I
haven´t been able to figure our how how to make a script that does the job
for me when this BU is triggered.

Are you aware of what to do or maybe there is a site out there that has
collections of Access-scripts ?

regards
Carsten
 
L

Luke Bellamy

strConfirmUpdate should probably be varConfirmUpdate
to follow a better coding standard.
Sometimes (actually most the time) I type faster than my
brain works... and my typing is not that fast :)

--
Luke Bellamy
Newcastle, Australia


Luke Bellamy said:
Carsten,
Are you after something like this:
*AIR CODE*

Private Sub Form_BeforeUpdate()
Dim strConfirmUpdate as Variant

' Gives the user a Yes/No option and sets the default to the 2nd button
which in this case is NO
strConfirmUpdate = MsgBox("WARNING ! .....Record has been
updated....click YES to confirm changes or NO to cancel changes", "My
Application Name", vbYesNo + vbDefaultButton2)

' If they do not wish to save changes then undo any made to this record
If strConfirmUpdate = vbNo then
Me.Undo
End If

End Sub

Please let me know if this is not what your after and I might
be able to point you in a better direction.
As for we sites that have code samples probably the
most well known site is http://www.mvps.org/access.

HTH
--
Luke Bellamy
Newcastle, Australia


Carsten Witt said:
Luke

Thanks for your suggestion. I was aware of the BeforeUpdate parameter,
but
 
C

Carsten Witt

Luke,

I am not much of a programmer, but based on your annotation, it looks pretty
much/exactly what I need.

I´ll try to paste it into my database and give it a workaround.

Many thanks for your help...much appreciated.

Carsten
 

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