Is there a way to prevent a form from saving a record when there is no actual data entry?

22 views Asked by At

I have a form to create work orders that opens up when I click a button from a Sales Order form. The SalesOrderID field autopopulates to match the SalesOrderID from the Sales Order form.

But for the Work Order number I set the default value to autopopulate to a sequential number (using Dmax against the previous records).

So the new, next available Work Order number pops up when I open the WorkOrder form as acFormAdd.

The problem is that even if the user immediately closes the form and re-opens the form the Work Order Number is still saved to a record in the underlying table even though no actual "data entry" occured. When the user re-opens the form the Work Order number just goes up again instead of the correct number (because it somehow got saved).

Is there a way to prevent this from happening. I want the Work Order Number to be the next highest number no matter how many times the user opens a form and closes without doing any actual data entry. Why is the form saving the number in the table? I combed through the controls of the form and removed any Recalc or requery actions on a LostFocus event. But now there is only actions coded for Afterupdate or change events so I can't figure out why the record is saving. Any ideas on how to troubleshoot this?

0

There are 0 answers