Commit to table when get Error

  • Thread starter Thread starter Richo
  • Start date Start date
R

Richo

I have a form and when I am testing it and I get an error pops up on the
screen, what ever I have on the screen is saved to a table tblMeal.
When I fill in the full screen and click the save button the information is
saved to two tables and works ok, however when a error is displayed (testing
it and some piece of code needs ajusting) only 1 of the tables is the
information uodated to if those fields are filled in.
Is this a property setting and why would it update if there is a error?
 
Since I don't know how your form works, I can't be specific, but the reason
one updates and the other does not is the error is occuring after the first
table is updated.
 
Thanks Klatuu. I may not have explained myself enough, however the error is
not happening when I am clicking the save button. Say I am closing the form
and click the exit button and an error appears the information on the screen
is saved to the table. If no error then the form would have closed and the
data not saved.

It seemd when there is an error access commits any data to the table, why
and how do you fix or control the issue?
 
Sorry, Richo, but I am not quite understanding. In your original post you
said one table is updating, but not the other.

Are you using a form/subform or is one of the tables unbound or is the
form's query based on two table.

Can you please describe in a bit more detail.
 
Klatuu sorry if I am confusing you, however the issue is that if a error
appears while this form is up data is committed to a table, nothing to do
when I save a record.
Just a form with eight text fields and 6 commard buttons where the fields
are based on a table and one of the fields I update to another table (not the
issue)
If the form crashes (displays an error) while does it update to a table?
Hope you understand the problem, thanks
 
Okay, I think I understand your question now. Your table is updating because
something in your form operation is moving off the current record. Any time
you move off the current record the data will be saved to the tabe unless an
error occurs before the update. In your case, the error is happening after
the data has been updated or possibly the error does not have anything to do
with the form's record source.

What is the error number and message you are getting? When does the error
occur? Have you traced the code to see if you can determine when it happens.
 
Ok lets take 2 examples
I fill one on the fields txtMeal and click on the close button, that one
line is commit to the table, not even the auto number is updated. (Do I need
to clear the fields before closing the form ?)
Example two
On the Modify button, when I click it, it displays some more buttons to
search on. In the Private Sub btn_adjust_meal_Click() I changed
Me.btn_search.Visible = True to Me.btn_serch.Visible = True. I saved and
filled the same field and clicked the button and got a Compile Error (as you
would) and the text in the field was saved to the table.
What ever fields are filled they are saved when the error is displayed or I
close the form.
Hope you understand ??
The form seems to automatically save.....
 
I don't know that I can explain it any more clearly. If you enter any data
in a form and close the form, the data will update the form's recordset
unless the error is a data error that would prevent the the data from
updating.

You can control that by using Me.Undo to clear the data from the form. The
problem you are having is that the error is happening after the data is
updated.
 
Hi Klatuu. Thanks forthat, I understand about when I close the form and will
make the change. With the situation with the error, you are saying that if
the focus moves off the current record then it is updated, that is ok at
least now I understand

Thanks Again.
 
That is a good way to put it. When the focus moves off the current record,
the data is updated.
 
Back
Top