Results 1 to 3 of 3

Thread: [RESOLVED] Access help - updating a second field automatically after inital update

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2008
    Posts
    12

    Resolved [RESOLVED] Access help - updating a second field automatically after inital update

    Hi

    I am using Access 07. I have a record which has a number of fields, what I want to do is to automatically update a second field called "last modified" which gets modified if any of the fields get modified and not on a read.

    I tried attaching the following code to the Form_AfterUpdate() event
    Code:
    Dim db As Database
        Dim qdf As DAO.QueryDef
        
        Set db = CurrentDb
        Set qdf = db.QueryDefs("staffRecodUpdateTime")   
        
        qdf.Parameters("modTime").Value = Now()
        qdf.Parameters("staffRef").Value = CInt([Form]![Text187].Value)
        qdf.Execute dbFailOnError
        
        qdf.Close
        Set qdf = Nothing
        Set dbs = Nothing
    but when i exit the form I get the "write conflict - This record has been changed by another user since you started editing it..." with the three options "save record", "drop changes", "copy to clip board"

    There is no other user part from myself using the database.

    Is there a way to either automatically suppress the msg or committing my change regardless?

    Any help appreciated!

  2. #2
    Hyperactive Member Davadvice's Avatar
    Join Date
    Apr 2007
    Location
    Glasgow (Scotland)
    Posts
    440

    Re: Access help - updating a second field automatically after inital update

    hi,

    You could try the below

    vb Code:
    1. DoCmd.SetWarnings =False

    Remember to set them to true after you have closed the form.

    another option would be to add a sub and setting a boolean Value to true then call the sub when a user changes a form object like a txtname_Change Event

    David
    This is Blank

  3. #3

    Thread Starter
    New Member
    Join Date
    Oct 2008
    Posts
    12

    Re: Access help - updating a second field automatically after inital update

    Cheers for that.

    I also found another way:
    Code:
    If Me.Dirty = True Then Me.Dirty = False

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width