Access 2007 releasing saved records (1 Viewer)

jaydwest

JayW
Local time
Today, 13:55
Joined
Apr 22, 2003
Messages
340
I'm using a popup form to enter data in MS Access 2007. If I hit the save button to save the record and then attempt to edit a field, I get the message.

Another user editied this record and aved the changes before you attempted to save your changese.

I have code on the Form_BeforeUpdate that sets some fields on the form. If I remark these out, I do not get this error.

I'm using a form master that I have used for years to create forms. I have similiar forms updated from Access 2003 in the same Access 2007 database with the same code that work great.

I appears the Access 2007 saves the record before it can execute all the code in the Form_BeforeUpdate. I have seen some goofies like this in other events in MS Access 2007.

Tell me I'm not crazy. But if you have a solution, thanks.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 20:55
Joined
Sep 12, 2006
Messages
15,718
the problem occurs becasue you are editing the record in the orgiinal form

you then try to edit it in the popup form, and access gives you the TRUE error message that "another user " ie YOUR other form is editing the record

The easiest solution is to save the record before opening the popup

if me.dirty then me.dirty = false

the only issue is if you cannot save the record because you are opening the popup while (say) you are editing an new record, which is still incomplete - then you may end up with some tortuous error handling.

I am sure this is not just an A2007 thing.

==========
what data is in the popup form.? is it just an enlarged single field. If so, try hitting shift-F2
 

jaydwest

JayW
Local time
Today, 13:55
Joined
Apr 22, 2003
Messages
340
The issue is not related to any other form I have open. If I open the popup form directly from the nav bar, I get the same problem.

I get this problem is I call a function in another module or if I update some fields on the form in the Before Update event.

If I do not do either of these, I can edit and save to my heart's content.

Any other thoughts. Keep in mind that I have the exact same code in numerous popup forms that were brought overe from Access 2003 and they work just fine.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 20:55
Joined
Sep 12, 2006
Messages
15,718
maybe you have some corruption within your data.

open the table directly, and see if you can edit things directly in the tables.
 

vbaInet

AWF VIP
Local time
Today, 20:55
Joined
Jan 22, 2010
Messages
26,374
It's your Before_Update code that's causing the problem. It may be that you have already updated a control that is bound to your form's or control's record source/control source. Is the code also in a subform? Can you show what the code is?
 

jaydwest

JayW
Local time
Today, 13:55
Joined
Apr 22, 2003
Messages
340
It is definitely the FOrm_B4Update code that is causing the problem. When I remark out all the code that sets controls, it works fine.

I seems that MSA2007 is saving the record B4 the B4Update is complete. Wouldn't put it past it to do that. Funny that code from MS2003 in the same DB works great. Is there any new form options in MSA2007 that could be causing this problem?

Thanks for your help.
 

vbaInet

AWF VIP
Local time
Today, 20:55
Joined
Jan 22, 2010
Messages
26,374
I suppose Access 2007 is more clever :)

It could happen if you are upating a bound field but move away from the field, or set the bound field's value from another form and then click back into it. Have you got the code to show?
 

jaydwest

JayW
Local time
Today, 13:55
Joined
Apr 22, 2003
Messages
340
I moved all the code that updated controls on the form to the Form_BeforeInsert event and now it works. This database was migrated from MS2000 & MS2003. I wonder if this created the issue.

Strange but true.

Thanks again for all your help.
 

vbaInet

AWF VIP
Local time
Today, 20:55
Joined
Jan 22, 2010
Messages
26,374
I would give that a thorough test before giving it a rest though :)

I tend to convert the DB from 2000 to 2003, then from 2003 to 2007. Just a thing I do and I think it may even be advisable. I never run into problems that way.

You're welcome. Glad you got it sorted.
 

jaydwest

JayW
Local time
Today, 13:55
Joined
Apr 22, 2003
Messages
340
All my 2000/2003 forms int ehe 2007 db work perfectly too. This is a new form, I created from scratch in 2007 but pasting in code from a code library I use. I have had other issues with 2007 where is moved off a record before the AfterUpdate event was executed and I could not grab a conttol's value to use elsewhere. These issues have happened on two different systems and two different databases, so I doubt it's a corruption issue.

Maybe I'm crazy, but do you have a better explantion.
 

vbaInet

AWF VIP
Local time
Today, 20:55
Joined
Jan 22, 2010
Messages
26,374
You couldn't get the value because the cursor is no longer on that record. 2007 fixes previous bugs and adds more constraints. There must be some lines of code that doesn't comply with the new rules in Access 2007. Consider converting a copy of the whole DB the way I explained and see the outcome.

Using your 2000/2003 forms in 2007 will maintain the level of constraints they previously had.
 

Users who are viewing this thread

Top Bottom