error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • developing
    New Member
    • Mar 2007
    • 110

    error

    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:

    Code:
    Private Sub cmdEdit_Click()
                DoCmd.RunSQL "UPDATE tMainDiscount " _
                & "SET [Discount Level] = " & strDisc _
                & ", [Date Revised] =  #" & dateTime & "#" _
                & " WHERE [Customer Number] = " & longCust _
                & ";"
    End Sub
    
    
    AFTER RUNNING THIS CODE ^ and then moving 
    onto the one below is the only time i get the msg. 
    both act on same records...
    
    
    Private Sub cmdDiscount_Click()
        
    'UPDATE DISCOUNT LEVEL
            CurrentDb.Execute "UPDATE tMainDiscount " _
            & "SET [Discount Level] = " & strDisc _
            & " WHERE [Customer Number] = " & longCust _
            & " And [PGR] = '" & strPGR & "'" _
            & ";"
           
    'TIME STAMP FOR THE UPDATE
            DoCmd.RunSQL "UPDATE tMainDiscount " _
            & "SET [Date Revised] =  #" & dateTime & "#" _
            & " WHERE [Customer Number] = " & longCust _
            & " And [PGR] = '" & strPGR & "'" _
            & ";"
    
              
            DoCmd.Requery "lstPGR"
    End Sub


    thanks
    Last edited by developing; Mar 23 '07, 08:33 PM. Reason: Clearer code
  • nico5038
    Recognized Expert Specialist
    • Nov 2006
    • 3080

    #2
    Guess a requery will get rid of the message, but why not combine the UPDATE into:
    Code:
    'UPDATE DISCOUNT LEVEL and TIME STAMP
            CurrentDb.Execute "UPDATE tMainDiscount " _
            & "SET [Discount Level] = " & strDisc ",  [Date Revised] =  #" & dateTime & "#" _
            & " WHERE [Customer Number] = " & longCust _
            & " And [PGR] = '" & strPGR & "'" _
            & ";"
    Nic;o)

    Comment

    • developing
      New Member
      • Mar 2007
      • 110

      #3
      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....depe rating update and date is the only way everything works....dont know why, but it works..

      im on access 97

      Comment

      • nico5038
        Recognized Expert Specialist
        • Nov 2006
        • 3080

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

        Nic;o)

        Comment

        • developing
          New Member
          • Mar 2007
          • 110

          #5
          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?

          Comment

          • developing
            New Member
            • Mar 2007
            • 110

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

            thanx for all ur help Nic;o)

            Comment

            Working...