Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2013

    Unanswered: onclick code create record


    I wish to create some traceability because on changes in my database...

    I have a form which displays a date field, for example: [due date]. This form links to tblActionLog.

    Other tables include: tblUsers.

    If someone changes the [due date] to another date, I wish the following text to be inserted into a memo field within tblTraceability:

    ...due date changed from (the date that was previously entered) by [User]...

    Any ideas please...

  2. #2
    Join Date
    Mar 2009
    Provided Answers: 15
    You could use something like:
    Private Sub DueDate_BeforeUpdate(Cancel As Integer)
        const c_SQL As String  = "INSERT INTO tblTraceability (MemoFieldName ) " & _
                                 "VALUES ( 'due date changed from @D by @U');"
        Dim strSQL As String
        strSQL = Replace(Replace(c_SQL, "@U", Me.User.Value), "@D",  Me.DueDate.OldValue)
        CurrentDb.Execute strSQL, dbFailOnError
    End Sub
    Have a nice day!

Posting Permissions

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