469,338 Members | 8,076 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,338 developers. It's quick & easy.

Error - The data has been changed

Afternoon all,

Cheers to anyone who can help! So far this forum has been a big lifeline to me!!

I believe this to be the last hurdle before my database is complete!

Problem - I have a main form with 3 subforms. Each subform is hidden until it is made visible through use of a check box (code has been written to only allow one box to be visible at any one time). These had been working perfectly but all of a sudden I have begun to get the error message

"The data has been changed. Another user edited this record and saved the changes before you attempted to save your changes"

This is hard to believe as i am the only person using the database. I have found a few articles relating to this but no-one ever suggests a possible fix for this problem.

The Microsoft site says to fix the problem to add "Me.Parent.Requery" to the AfterUpdate event on the subforms. This does work but now when you try to change subforms using the check boxes, the 1st click on a check box appears to trigger the AfterUpdate but then you have to re-click the same check box to acctually change forms.

i.e. to change to Travel Subform from Cars you have to click the Travel Check Box, wait a second or two, and then click the Travel Check Box again to actually get it to change.

Seems a little pedantic i know but it just makes the form non user friendly.

Open to suggestions!! Cheers.
Nov 30 '06 #1
22 11267
MMcCarthy
14,534 Expert Mod 8TB
In Tools - Options under the Advanced tab.

Is your Default Record Locking set to Edited Record?

Is Open databases using record-level locking ticked?
Nov 30 '06 #2
Default Record Locking is set to "No Locks"

The Open databases using record-level locking is ticked.
Nov 30 '06 #3
MMcCarthy
14,534 Expert Mod 8TB
Default Record Locking is set to "No Locks"

The Open databases using record-level locking is ticked.
Change Default Record Locking set to "Edited Record" and comment out the Me.Parent.Requery code. Does this solve the problem?

Mary
Nov 30 '06 #4
Alas not,

Commenting out the Me.Parent.Request code allows me to switch between the subforms on a single click but I now get the error message again (Record locking changed to "Edited Record")

The subforms update perfectly well regardless of the error message. Is there anyway to disable certain error messages so the code carries on unhindered?

(cheers for the help)
Nov 30 '06 #5
MMcCarthy
14,534 Expert Mod 8TB
Alas not,

Commenting out the Me.Parent.Request code allows me to switch between the subforms on a single click but I now get the error message again (Record locking changed to "Edited Record")

The subforms update perfectly well regardless of the error message. Is there anyway to disable certain error messages so the code carries on unhindered?

(cheers for the help)
When you click the tickboxes are the subforms just switching from invisible to visible?
Nov 30 '06 #6
Yes, the check boxes only change the visible state from true -> false (or vice versa). On the main form the 3 subforms are on top of one another. I read articles about over laying. Half said dont do it, the other half said its fine as long as you dont need to change the layout later.
Nov 30 '06 #7
MMcCarthy
14,534 Expert Mod 8TB
Yes, the check boxes only change the visible state from true -> false (or vice versa). On the main form the 3 subforms are on top of one another. I read articles about over laying. Half said dont do it, the other half said its fine as long as you dont need to change the layout later.
I've used a similar procedure before. The record shouldn't be trying to update just because the subform is going invisible.

Are your tickboxes based on a option group or are they individual?
Nov 30 '06 #8
The tickboxes are individual
Nov 30 '06 #9
MMcCarthy
14,534 Expert Mod 8TB
The tickboxes are individual
Can you post the code for one of the tickboxes with the Me.Parent.Requery included.
Nov 30 '06 #10
Here is the code I am using to control the check boxes

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub CarSelect_Click() 
  3.  
  4.    If CarSelect = True Then ' tickbox3
  5.       SubGeneral.Visible = False ' subform1
  6.       GeneralSelect = False ' tickbox1
  7.       SubTravel.Visible = False ' subform2
  8.       TravelSelect = False ' tickbox2
  9.       SubCar.Visible = True ' subform3
  10.    Else
  11.       SubCar.Visible = False ' subform3
  12.    End If
  13.  
  14. End Sub
  15.  

This code is located in the main form.

I deleted the "Me.Parent.Requery" code. The Me.Parent.Requery code was on the subforms unlike the check box code.

p.s (finishing for the day, so wont reply for an hour or 2)
Nov 30 '06 #11
I deleted the "Me.Parent.Requery" code. The Me.Parent.Requery code was on the subforms unlike the check box code.

p.s (finishing for the day, so wont reply for an hour or 2)

Forgot to mention, that was the only code on the subforms
Nov 30 '06 #12
MMcCarthy
14,534 Expert Mod 8TB
Try this ...

Expand|Select|Wrap|Line Numbers
  1. Private Sub CarSelect_Click()
  2.  
  3.    Me.Requery
  4.  
  5.    If CarSelect = True Then ' tickbox3
  6.       SubGeneral.Visible = False ' subform1
  7.       GeneralSelect = False ' tickbox1
  8.       SubTravel.Visible = False ' subform2
  9.       TravelSelect = False ' tickbox2
  10.       SubCar.Visible = True ' subform3
  11.    Else
  12.       SubCar.Visible = False ' subform3
  13.    End If
  14.  
  15. End Sub
  16.  
Nov 30 '06 #13
No luck, it doesnt get rid of the error message.

I put a few breaks into the code (I have put the Microsoft code back in) to see what On Event procedures were running at what time.

When a subform is modified, and a check box is click on, the AfterUpdate event is triggered (as you would expect) and runs but then the On_click event doesnt trigger. I have tried clicking else where on the main form after modifying the subforms but it doesnt trigger unless another check box or combo box (on the main form) is selected.

Is there anyway to enter the Me.Parent.Requery style requery into the On_click event on the check boxes to requery the subforms without having to rely on the AfterUpdate event or is this not possible?
Dec 1 '06 #14
MMcCarthy
14,534 Expert Mod 8TB

Is there anyway to enter the Me.Parent.Requery style requery into the On_click event on the check boxes to requery the subforms without having to rely on the AfterUpdate event or is this not possible?
The first line in the code I sent you...
Expand|Select|Wrap|Line Numbers
  1.  
  2. Me.Requery
  3.  
Is the same thing. You don't need Parent because you're on the main form.
Dec 1 '06 #15
The first line in the code I sent you...
Expand|Select|Wrap|Line Numbers
  1.  
  2. Me.Requery
  3.  
Is the same thing. You don't need Parent because you're on the main form.
Rather silly question of me to ask in hind sight!
Dec 1 '06 #16
MMcCarthy
14,534 Expert Mod 8TB
Rather silly question of me to ask in hind sight!
Don't worry about it.

More importantly, does it solve your problem?

Mary
Dec 1 '06 #17
Don't worry about it.

More importantly, does it solve your problem?

Mary
Nope, still get the same data error message even with the Me.requery in the On_click event.

I think that I am going to have to re-do my main form but this time not hide the forms one behind another. What way would you recommend laying out a main form with 3 subforms (only 1 subform is allowed to be viewed at a time).

I think the main prob with this database is that its the 1st one i have ever designed and I keep finding quicker and easier ways to write code that I wrote the week before, so I am thinking of just re-writting the whole thing!!

Cheers for all the help Mary :)
Dec 1 '06 #18
MMcCarthy
14,534 Expert Mod 8TB
Nope, still get the same data error message even with the Me.requery in the On_click event.

I think that I am going to have to re-do my main form but this time not hide the forms one behind another. What way would you recommend laying out a main form with 3 subforms (only 1 subform is allowed to be viewed at a time).

I think the main prob with this database is that its the 1st one i have ever designed and I keep finding quicker and easier ways to write code that I wrote the week before, so I am thinking of just re-writting the whole thing!!

Cheers for all the help Mary :)
You could use a multi page object.

Before you scrap the idea completely, change your click boxes to command buttons. This is what I used when I was hiding/unhiding subforms. It may make a difference.

Mary
Dec 1 '06 #19
You could use a multi page object.

Before you scrap the idea completely, change your click boxes to command buttons. This is what I used when I was hiding/unhiding subforms. It may make a difference.

Mary
Mary you are a god send!!!

I never have tried changing the check boxes to command buttons as i figured it wouldnt make any difference as the both worked on "on click" events.

Works a treat now!! Thanks massively.
Dec 1 '06 #20
MMcCarthy
14,534 Expert Mod 8TB
Mary you are a god send!!!

I never have tried changing the check boxes to command buttons as i figured it wouldnt make any difference as the both worked on "on click" events.

Works a treat now!! Thanks massively.
At a guess I would say with the tickboxes Access was attributing values to them whereas it doesn't with command buttons.

Mary
Dec 1 '06 #21
NeoPa
32,182 Expert Mod 16PB
Fascinating thread.
Who would have thought Access would behave so unpredictably ;)
Nice work getting it sorted out - particulary Mary.
Dec 1 '06 #22
Really Fascinating,
I have a same sort of problem but I do need Checkboxes, since they do Hold Information.

I have a subform with analising results, which is initially filles with default values. The checkbox tells me wether to print the results.

When I Re-analyse, the new records are added to the list, and I need the checkboxes to be copied to the newest results. All goes well so far...
Then I need to remove the older results from the report, and run a query that unchecks the checkboxes on the older records. At the end of this routine I requery, to update the form and I get the same erroromessage as Philelpko...

I tried in-code SQL vs Access-Queries for it was documented somewhere on the internet as a problem between access and sql regarding interpretation of booleans (-1 vs 1), no result.

Any more suggestions without changing the checkboxes???
Sep 30 '10 #23

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

19 posts views Thread by Taras_96 | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by Purva khokhar | last post: by
1 post views Thread by haryvincent176 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.