Results 1 to 3 of 3

Applying AuditTrail to subform on a form

  1. #1
    jle0003 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Apr 2012
    Posts
    60

    Applying AuditTrail to subform on a form


    I have a Customer form that is set up with the customer information (customer id, name, address, phone #, etc) across the top and across the bottom is a subform called Orders. Obviously each customer can have multiple orders so the subform is in datasheet view with the typical fields like order id, qty, description, price, status). I wanted the ability to track changes in the "Status" field in the oders subform. I wanted an Update printed for each time the status was changed from order processed to order shipped, etc...

    I used the "Audit Trail for record changes" code from here: http://support.microsoft.com/kb/197592 which worked...sort of. Btw, I editted the code to update me for the Staus field only instead of every field on the form.

    The problem is, when I open just the sfrmOrders by itself and make a change to the Status field, the update prints out beautifully. However, when I open the Customer form that has the sfrmOrders attached, the Update does not print. It is not recognizing changes in the Status field. I tried adding the =AuditTrail() to the BeforeUpdate event of the Customer form and that still didn't work. Any ideas? Please help!

    Thanks!!!

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    8,481
    Have you set a breakpoint in the "AuditTrail" function and checked the value of the variable "MyForm"? I am curious what form is the active form - the main form or the subform. Step through the function to find out what is happening..
    Code:
    Function AuditTrail() On Error GoTo Err_Handler
         Dim MyForm As Form, C As Control, xName As String
         Set MyForm = Screen.ActiveForm
          <snip>

    Allen Browne also has an audit trail example:

    http://allenbrowne.com/AppAudit.html
    HTH
    -----
    Steve
    --------------------------------
    "Veni, Vidi, Velcro"
    (I came; I saw; I stuck around.)

  3. #3
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,896
    I believe Allen's works for SubForms as well.
    (RG for short) aka Allan Bunch Previous MS Access MVP - WinXP Pro, Win7 Pro Win10 Pro - acXP, ac07, ac10, ac13
    How to mark the thread as Solved!
    Teaching is not filling a bucket but lighting a fire.
    Borrowed quote..."Docendo discimus"

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 10
    Last Post: 08-01-2012, 11:32 AM
  2. Applying a Rating in A Form
    By Lupson2011 in forum Forms
    Replies: 5
    Last Post: 02-14-2012, 11:40 AM
  3. applying a charge routine
    By rbrookes8dec in forum Access
    Replies: 1
    Last Post: 08-08-2010, 11:01 AM
  4. Access Reports - Applying a subform filter
    By AMCUser in forum Queries
    Replies: 13
    Last Post: 06-25-2010, 07:32 PM
  5. Applying a filter to a combo box
    By bugchaser in forum Programming
    Replies: 1
    Last Post: 02-20-2009, 02:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Tech Forums: Microsoft Office Forums