Doing Error Checking before moving to next record 
Author Message
 Doing Error Checking before moving to next record

I want to perform my own error checking on the entered information
before the user is able to move on to the next record. The only place I
can see to put this error checking is in the forms BeforeUpdate event.
This way, I will be able to check what was entered and if necessary
cancel the Next record operation. However, I only want to perform this
error checking when I move to a different record. I have found that the
BeforeUpdate event not only runs when I go to a new record, but also
when I close the form (which isn't the biggest problem) and when I try
to access a subform. The running of BeforeUpdate before accessing the
subform really causes problems, sincethe subform is still part of the
overall information of the current record. How can I avoid the error
checking when the user clicks on the subform, and just do it when the
user changes records? Appreciate any help that you can give me.

Chad Waldman



Wed, 17 Jan 2001 03:00:00 GMT  
 Doing Error Checking before moving to next record
Chad,

The problem here is that you may consider the subform information part of
the same record, but Access sees it a little differently.  When you move
from the main form to the subform or back, whichever one you're moving has a
save triggered because you are moving off the current record.  If there are
errors in the data that will keep the record from being saved, you'll get
error messages.

If you could disable or bypass this, you'd destroy the integrity of the
database.  Instead, do your error checking in the BeforeUpdate event of both
the form and subform and force the user to enter any required fields in
whichever has the focus by popping up a message box and setting Cancel =
True.  In other words, "do this or I won't let you do that".  The Cancel
setting in BeforeUpdate won't rollback the record, it will just force the
user to add any missing data required for a valid record before it lets them
move to the other form.  Once they add the required fields, they can move to
the subform or back with no problem.

C{*filter*}te Foust

Quote:

>to access a subform. The running of BeforeUpdate before accessing the
>subform really causes problems, sincethe subform is still part of the
>overall information of the current record. How can I avoid the error
>checking when the user clicks on the subform, and just do it when the
>user changes records? Appreciate any help that you can give me.



Thu, 18 Jan 2001 03:00:00 GMT  
 Doing Error Checking before moving to next record
Put the error handling code in the Forms On Error event.
Quote:

>I want to perform my own error checking on the entered information
>before the user is able to move on to the next record. The only place I
>can see to put this error checking is in the forms BeforeUpdate event.
>This way, I will be able to check what was entered and if necessary
>cancel the Next record operation. However, I only want to perform this
>error checking when I move to a different record. I have found that the
>BeforeUpdate event not only runs when I go to a new record, but also
>when I close the form (which isn't the biggest problem) and when I try
>to access a subform. The running of BeforeUpdate before accessing the
>subform really causes problems, sincethe subform is still part of the
>overall information of the current record. How can I avoid the error
>checking when the user clicks on the subform, and just do it when the
>user changes records? Appreciate any help that you can give me.

>Chad Waldman




Thu, 18 Jan 2001 03:00:00 GMT  
 Doing Error Checking before moving to next record
No, put the error checking in the BeforeUpdate event, as the Forms On Error
event is only triggered if what is entered does not pass the validation rule
defined on the form for that control. For bound controls, I don't know if it
considers the validation rule defined in the table.

Lilla

Quote:

>Put the error handling code in the Forms On Error event.


>>I want to perform my own error checking on the entered information
>>before the user is able to move on to the next record. The only place I
>>can see to put this error checking is in the forms BeforeUpdate event.
>>This way, I will be able to check what was entered and if necessary
>>cancel the Next record operation. However, I only want to perform this
>>error checking when I move to a different record. I have found that the
>>BeforeUpdate event not only runs when I go to a new record, but also
>>when I close the form (which isn't the biggest problem) and when I try
>>to access a subform. The running of BeforeUpdate before accessing the
>>subform really causes problems, sincethe subform is still part of the
>>overall information of the current record. How can I avoid the error
>>checking when the user clicks on the subform, and just do it when the
>>user changes records? Appreciate any help that you can give me.

>>Chad Waldman




Fri, 19 Jan 2001 03:00:00 GMT  
 Doing Error Checking before moving to next record
One thing comes to mind, although I have not tried it:

- In the AfterUpdate, create a bookmark to the changed record (in the form's
Recordsetclone).  In the OnCurrent (of the 'next record'), use the
Recordsetclone to analyze the data of the last record modified.  (You may be
able to set the clone's bookmark to .LastModified to access the most
recently changed record - if not, store the bookmark in a global variant).
If the data does not pass the test, move back to the orig record.  You may
even be able to 'Undo' the changes with domenuitems (now docmd.runcommand).

Good Luck!

Quote:

>I want to perform my own error checking on the entered information
>before the user is able to move on to the next record. The only place I
>can see to put this error checking is in the forms BeforeUpdate event.
>This way, I will be able to check what was entered and if necessary
>cancel the Next record operation. However, I only want to perform this
>error checking when I move to a different record. I have found that the
>BeforeUpdate event not only runs when I go to a new record, but also
>when I close the form (which isn't the biggest problem) and when I try
>to access a subform. The running of BeforeUpdate before accessing the
>subform really causes problems, sincethe subform is still part of the
>overall information of the current record. How can I avoid the error
>checking when the user clicks on the subform, and just do it when the
>user changes records? Appreciate any help that you can give me.

>Chad Waldman




Fri, 19 Jan 2001 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. How to move to the next record?

2. Disable move to prev/next record when turning mouse wheel

3. How to move to the next record

4. How to make combo box move to next record

5. Move next takes user to new record - not wanted

6. Move Next Record

7. Data control will not refresh/move to next record

8. How to move to the next record?

9. Move to next record in DAO

10. Disconnected Recordset will not move to the next record

11. Next Record Value Check

12. Checking for next object in record

 

 
Powered by phpBB® Forum Software