Write conflict message

L

Luis

Hi.
I've posted the following question a couple of days ago and i received the
reply i'm sending. The problem is that i'm not sure i understand how can i do
this. The form's recordsource is an SQL command that is executed in the On
Open event. How can i set the field values in the Before Update event? The
form is a continuous form and can retreive an undetermined number of records.

Hello.
I have a form in which i have a text box with an after update event. This
after update event executes an Update table SQL command. The problem is that
after this event occurs i get an Write Conflict message. I then click on Save
changes button and the error disappears.
I already put the Docmd.setwarnings FALSE command, but the message still
triggers.
How can i prevent this ?

Thanks in advance

Luis

It appears that your update is updating the same table/record that the form
is bound to. Why? The usual thing to do would be to set the appropriate
field values in the BeforeUpdate event, and leave it up to the form to
perform the update.
 
T

Tim Ferguson

The form's recordsource is an SQL
command that is executed in the On Open event. How can i set the field
values in the Before Update event?

As the previous responder said, why would you want to? The point of binding
a form to a recordset is that Access looks after all the loading and saving
of values for you. Just let it get on with it.
The form is a continuous form and
can retreive an undetermined number of records.

Situation normal then: that is how Access works.

B Wishes


Tim F
 
L

Luis

I'm not sure if i'm being clear. The form initially is unbound, and when i
double-click on a control on another form this unbound form opens and runs a
select command as recordsource based on the value that was on the control
that was double-clicked. Ok, so far. Then i need to allow the users to update
some information contained on the form. And the problem is here. On this form
i have 2 fields, one with parcial amounts and one with total amounts, all for
the same item. On the parcial amounts control i have an after update event
that sums all the parcial amounts of the item in question to check if the sum
is less or equal to the amount. What i found out is that when i update the
parcial amount and the event triggers, i create a recordset to perform this
verification and the table in question still contains the old value. That is
why i put an SQL Update command before this verification. That was a solution
that solved the problem but triggers me the Write confilct message.
 
T

Tim Ferguson

The form initially is unbound, and when i
double-click on a control on another form this unbound form opens and
runs a select command as recordsource based on the value that was on
the control that was double-clicked. Ok, so far.

No, not ok -- if the form has a recordsource then it's bound, and you may
as well use the features that Access provides. If it's unbound, then you
don't have a recordsource, and you can use the form events to write
whatever you like to the tables.

I don't see the point of fighting against Access rather than letting it do
the work for you -- but then again, I can't see your application.

All the best


Tim F
 
B

BlackmanChCh

=?Utf-8?B?THVpcw==?= said:
Hi.
I've posted the following question a couple of days ago and i receive
the
reply i'm sending. The problem is that i'm not sure i understand ho
can i do
this. The form's recordsource is an SQL command that is executed in th
On
Open event. How can i set the field values in the Before Update event
The
form is a continuous form and can retreive an undetermined number o
records.



It appears that your update is updating the same table/record that th
form
is bound to. Why? The usual thing to do would be to set th
appropriate
field values in the BeforeUpdate event, and leave it up to the form to
perform the update.


Gidday,

Can you send me your code for this, I have a similar problem that
have fixed using me.repaint, me.refresh

BlackmanChC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top