Connecting Tech Pros Worldwide Forums | Help | Site Map

error

Member
 
Join Date: Mar 2007
Posts: 110
#1: Mar 23 '07
Hello,

Hows it going people....so...its this annoying msg:

Data has been changed
Another user changed record and saved them before you.
Re-edit the record

"Another user" is me clicking the button that updates all records at once. Next thing i do is try update indivisual records (everything through the same form on the same table) and i get this msg...i can hit okay and continue no problem...but i need this annoying popup to go away...how?

both updates act on same records, i need someway to tell the first one that its done and now go away..lol...how do i do this?

All of the operations performed use SQL statements. code:

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub cmdEdit_Click()
  3.             DoCmd.RunSQL "UPDATE tMainDiscount " _
  4.             & "SET [Discount Level] = " & strDisc _
  5.             & ", [Date Revised] =  #" & dateTime & "#" _
  6.             & " WHERE [Customer Number] = " & longCust _
  7.             & ";"
  8. End Sub
  9.  
  10.  
  11. AFTER RUNNING THIS CODE ^ and then moving 
  12. onto the one below is the only time i get the msg. 
  13. both act on same records...
  14.  
  15.  
  16. Private Sub cmdDiscount_Click()
  17.  
  18. 'UPDATE DISCOUNT LEVEL
  19.         CurrentDb.Execute "UPDATE tMainDiscount " _
  20.         & "SET [Discount Level] = " & strDisc _
  21.         & " WHERE [Customer Number] = " & longCust _
  22.         & " And [PGR] = '" & strPGR & "'" _
  23.         & ";"
  24.  
  25. 'TIME STAMP FOR THE UPDATE
  26.         DoCmd.RunSQL "UPDATE tMainDiscount " _
  27.         & "SET [Date Revised] =  #" & dateTime & "#" _
  28.         & " WHERE [Customer Number] = " & longCust _
  29.         & " And [PGR] = '" & strPGR & "'" _
  30.         & ";"
  31.  
  32.  
  33.         DoCmd.Requery "lstPGR"
  34. End Sub


thanks

nico5038's Avatar
Moderator
 
Join Date: Nov 2006
Location: The Netherlands
Posts: 2,232
#2: Mar 24 '07

re: error


Guess a requery will get rid of the message, but why not combine the UPDATE into:
Expand|Select|Wrap|Line Numbers
  1. 'UPDATE DISCOUNT LEVEL and TIME STAMP
  2.         CurrentDb.Execute "UPDATE tMainDiscount " _
  3.         & "SET [Discount Level] = " & strDisc ",  [Date Revised] =  #" & dateTime & "#" _
  4.         & " WHERE [Customer Number] = " & longCust _
  5.         & " And [PGR] = '" & strPGR & "'" _
  6.         & ";"
  7.  
Nic;o)
Member
 
Join Date: Mar 2007
Posts: 110
#3: Mar 25 '07

re: error


i added a requery, didnt work


thats how i had the update statements originally. when i added the date stamp to the first piece of code (where all records are updates), the second (update indivisually) stopped working....deperating update and date is the only way everything works....dont know why, but it works..

im on access 97
nico5038's Avatar
Moderator
 
Join Date: Nov 2006
Location: The Netherlands
Posts: 2,232
#4: Mar 25 '07

re: error


Hmm, another reason might be that you have another form opened for the same table.

Nic;o)
Member
 
Join Date: Mar 2007
Posts: 110
#5: Mar 26 '07

re: error


Quote:

Originally Posted by nico5038

Hmm, another reason might be that you have another form opened for the same table.

Nic;o)


nope. only this one form is open. i think its because two seperate controls on the same form are operating on the same records...not simultaneously tho...is there any way i can prevent tis popup from appearing? i tried adding 'On Error resume next' but dont know where to add it?
Member
 
Join Date: Mar 2007
Posts: 110
#6: Mar 26 '07

re: error


alrite! fixed. i repainted the form...works...no more popup...

thanx for all ur help Nic;o)
Reply