G
Guest
I have a form with three fields. The first is a text field where the user
names the item they are working on - this is a primary key, no dupes allowed.
The next field is a date field they fill in. On this date field I have an
"after update" event procedure to save the record (using DoCmd.RunCommand
acCmdSaveRecord) then runs an update query to populate the third field with
some data. It is necessary to do this at this point so the user sees the
result of the update. It doesn't work if the record is not saved first. The
problem is that after the "save record" code procedure, if the text they have
typed in the first field is a duplicate key they get the long-winded default
duplicate key message. I know how to create an error handling procedure that
after you get to the end of the form and try to move to the next record you
can have a custom error message and return them to the field that needs to be
changed. But this only attaches to the "on error" property for the form. I
have tried to create an error handler that will do the same kind of thing
after the field in question is updated, but with no success. I have tried to
follow some examples, but the result is always the same - the default
message. How can I accomplish what the form "on error" handling routine
accomplishes back after the field update?
Thanks,
Jeff
names the item they are working on - this is a primary key, no dupes allowed.
The next field is a date field they fill in. On this date field I have an
"after update" event procedure to save the record (using DoCmd.RunCommand
acCmdSaveRecord) then runs an update query to populate the third field with
some data. It is necessary to do this at this point so the user sees the
result of the update. It doesn't work if the record is not saved first. The
problem is that after the "save record" code procedure, if the text they have
typed in the first field is a duplicate key they get the long-winded default
duplicate key message. I know how to create an error handling procedure that
after you get to the end of the form and try to move to the next record you
can have a custom error message and return them to the field that needs to be
changed. But this only attaches to the "on error" property for the form. I
have tried to create an error handler that will do the same kind of thing
after the field in question is updated, but with no success. I have tried to
follow some examples, but the result is always the same - the default
message. How can I accomplish what the form "on error" handling routine
accomplishes back after the field update?
Thanks,
Jeff