program flow

V

Vsn

Hello all,

Who can give me the right method on the following:-

In my DB the user can choose to cancel the data change before the update the
done to the record.

Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim stgMessage as string

stgMessage="Are you positive you like to update the record?"

If MsgBox(stgMessage, vbOKCancel + vbDefaultButton2, conTitle) = vbOK
Then
Else
DoCmd.CancelEvent
End If

End Sub

The change of record and thus above update check is triggered by a listbox,
which controls the record which is displayed. But if the record update is
canceled the requiry action of the list box generates error 2001 'You
canceled the privious operation'.

Private Sub lstPers_AfterUpdate()
Me.Requery
End Sub

How can I avoid this error, and still move to another entry in the listbox
and thus record.

Thx,
Ludovic
 
V

Vsn

Thx, for your reaction, to clarify myself:-

I would like to have a Pubilc variable for somthing like a standard path,
which does not change. In VB I know the sub Main is always executed at start
of the application, so any variable can be given a value there, how doe this
work in Access VBA? Where to give my variable a value so that is always
loaded.

Ludovic
 

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