What On Event procedure do I need?

D

Darren

I have a database that sits on SQL Server 2000 and users are restricted on
what actions they can perform on the objects. Via ODBC I have an Access
database for the forms, reports etc.

One of the forms uses a subform and here is the problem. The underlying
table of the subform can only be viewed by certain users thus if they tried
to change, delete or update a record, SQL Server would say "denied". Inside
the subform I have used an error trap that will convert the SQL Server
message into something more understandable to the end-user. If they click
on a save button within the subform the message displays as intended,
however, if they change something then click on a field in the main form,
they get the obscure SQL Server error instead.

My question is, how can I get the same user-friendly message if they either
click on save in the subform or move the focus to a field in the main form?
I have tried adding the message code to the sub-form's "On Lost Focus" event
but this does not work. I also added the same code to the "On Error" event
for both forms but again no joy. After the message is displayed using the
msgbox command I also have DoCmd.RunCommand acCmdUndo so that any changes
they tried to make is removed. If I did not do this, the user would be
trapped on the form and could only exit by closing Access.

I have also used the same code in the OnError events for both the subform
and main form to no avail.

Any advice would be greatfully received.

Regards
Dazza
 
R

Ron Weiner

Use the Subform Control's "OnExit" Property. I am talking about the control
that hosts your subform on the parent form, and not the subform itself.

Ron W
 
Top