Results 1 to 7 of 7
  1. #1
    PinkNinja is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2011
    Posts
    4

    Audit Trail for SubForms Not Working

    Unfortunately, I was unable to resolve my issue from the previous thread so I am starting a new thread.



    I have a unbounded mainForm with a tab control. Each tab contains it's own subForm that is bounded to it's respective tables. I need to implement an audit trail for data entry and updates for each of those respective subForms that allow data edits. I was trying to implement this Microsoft KB Article solution and followed the previous thread along with Allen Brown's suggestions but with no success. I looked into Allen Brown's own version of an audit trail but it seemed to complicated.

    The error message that I am getting when I attempt to update a record states "The expression Before Update you entered as the event property setting producted the following error: The expression you entered has a function name that [Form Name] can't find." In that subForm, I have the "=AuditTrail([Form])" in the BeforeUpdate event.

    Any help would be most appreciated.

  2. #2
    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,922
    SubForms are not directly referenceable in the Forms collection so they require special handling. http://www.mvps.org/access/forms/frm0031.htm
    Thanks for starting a new thread BTW.

  3. #3
    PinkNinja is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2011
    Posts
    4
    Thansk Rural Guy, that is a great reference but check this out. I changed the Before Update reference on the subform to just =AuditTrail(), essentially reverted back to the KB article and tested it. I put a line one the first line of the function for a msgbox pop up to let me know if it even started stepping into the fuction and I can't even get to that point. I just don't understand.

  4. #4
    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,922
    I believe the link you posted to the Microsoft site is not the right one. I have no idea what your code looks like and haven't a clue how to assist.

  5. #5
    PinkNinja is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2011
    Posts
    4

  6. #6
    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,922
    I'm not sure if the Screen.ActiveForm returns the Form or the SubForm object. You should be able to put a breakpoint in the AuditTrail() procedure and see what is being returned. I don't even know if that function would work for a SubForm. If you want to post your db, or at least enough of it so we can test it then we could look at it.

  7. #7
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    Quote Originally Posted by PinkNinja View Post
    Thansk Rural Guy, that is a great reference but check this out. I changed the Before Update reference on the subform to just =AuditTrail(), essentially reverted back to the KB article and tested it. I put a line one the first line of the function for a msgbox pop up to let me know if it even started stepping into the fuction and I can't even get to that point. I just don't understand.
    something else is going on. calling a function from a form event is normal. and no, subforms can not be referenced as active forms, because in that context, they're actually only controls. that's the reason using ''activeform'' will not work here.

    secondly, ninja, are you sure your test is valid? controls have to be bound to a field to cause that event to fire, AND data has to change.

    the other thing I'm wondering is if your procedure is actually a SUB instead of a FUNCTION? If it is, access will throw the exact same error you mentioned in the first post. And too, make sure that your sub or function is not PRIVATE.

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

Similar Threads

  1. audit Log
    By mwabbe in forum Access
    Replies: 42
    Last Post: 05-30-2011, 07:23 AM
  2. Audit trail not working on form with subform
    By jpkeller55 in forum Access
    Replies: 52
    Last Post: 01-07-2011, 12:39 PM
  3. Subforms
    By fwillia in forum Access
    Replies: 2
    Last Post: 09-24-2010, 08:03 AM
  4. Audit trail question #2
    By jpkeller55 in forum Access
    Replies: 9
    Last Post: 09-13-2010, 05:55 PM
  5. Audit trail question
    By jpkeller55 in forum Access
    Replies: 5
    Last Post: 09-13-2010, 04:12 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
  •  
Other Forums: Microsoft Office Forums