AfterUpdate Problems

D

Don

I have a relatively simple form which uses unbound text boxes to display and
edit information. When the form opens, an ADO Recordset is created. On the
form are record navigation buttons to move forward and backward by
performing MoveNext and MovePrevious respectively. The text boxes use
AfterUpdate to post the changes to the recordset by assigning the textbox
value to the recordset field (rstMyRecordset!Remarks = txtRemarks) followed
by a recordset update (rstMyRecordset.Update).

The problem I am having is if I edit the remarks of the first record, then
move to the next and try editing the remarks on the second record. As soon
as I enter a character, a pop-up appears saying:

The data has changed.
Another user editied this record and saved the changes before you attempted
to save your changes.
Re-edit the record.

I hit okay and everything works okay. Interestingly, this only seems to
happen when going from the first record to the second record and not others.
Also it does not happen when editing the second record and going back and
editing the first record.

Am I misguided in simply using AfterUpdate to post the changes to the
recordset? Should there be something in the form's record navigation
events?

Any advice will be greatly appreciated!

Thanks!

Don

"nvolved editing text in a "Remarks" text box (underlying field is a Memo
type).
 
G

Graham R Seach

Don,

I have to ask why you're doing it that way in the first place. Why not just
bind the form to the underlying table/query?

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
D

Don

Graham,

This form was started quite some time back when I read an arguement that it
is better to uncouple a form from it's underlying table or tables to allow
for more control. Following that path, I successfully created a number of
forms using the technique and was happy with the result. The arguements for
control, etc seemed to hold.

It appeared there was philosophical division among the participants in the
discussion on whether to use bound or unbound controls on forms.
Personally, I am sort of neutral on the matter other than having tried the
unbound approach and it working (most of the time). That said, I am open to
hearing the good, bad, and ugly for any approach and going off in a new
direction.

Given your advocation of the bound approach, what are the pros and cons?
Has the philosophical debate been settled and a winner declared?

Thanks!

DOn
 
G

Graham R Seach

Don,

It wasn't an advocation, just a question. The decision about whether to use
bound or unbound controls is entirely up to you and your specific situation.
I can list a raft of advantages and disadvantages of each scenario, but it
all depends on your situation. There's nothing wrong with usign a mixed
approach either.

If you want to continue using unbound controls, then to fix your problem,
we'll need a tad more information. For example, although your controls are
unbound, is the form similarly unbound? How are you getting the record
values into and out of the controls?

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------
 
D

Don

Graham,

You nailed it! The form's data source was set to the same table the
recordset is drawing from. Deleted the reference, and the problem is gone!
Gad, I would have pounded my head against the wall till I was silly finding
that one! I figured it is was in my choice of events or a code problem.
Moral: Unbound means unbound!

Thanks!!

Don
 

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