Bound Form Behavior

W

Wayne

MS Access 2000

I don't use bound forms often.

I want to change the data in one of the tables that acts
as the Record Source of a bound form. I want to make this
change behind the scenes in code. When the form is open,
the record I want to change is the current record.

I create a recordset and change the data in the code
behind the form based on a form event.

When I try to move away from this record, MS Access throws
a Write Conflict dialog box.

How can I update the record in the table or at least
defeat the dialog box?

Thanks.
 
R

Rick Brandt

Wayne said:
MS Access 2000

I don't use bound forms often.

I want to change the data in one of the tables that acts
as the Record Source of a bound form. I want to make this
change behind the scenes in code. When the form is open,
the record I want to change is the current record.

I create a recordset and change the data in the code
behind the form based on a form event.

When I try to move away from this record, MS Access throws
a Write Conflict dialog box.

How can I update the record in the table or at least
defeat the dialog box?

It is the fact that an additional RecordSet is doing the modification that
you are getting the conflict message. If it's always the record currently
displayed in the form why open another RecordSet? Just set the value
directly in the form.

The field doesn't have to be displayed in the form. As long as it's in the
Form's RecordSet you can just use...

Forms!NameOfForm!NameOfField = SomeValue
 
W

Wayne

OK. I figured this one out.

You need to force a save on the current record before you
change data in one of the tables that in used in the query
that serves as the Record Source of the bound form. MS
Access puts a write lock on the table if any data on the
form is changed before your code runs.

Thanks.
 

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