Results 1 to 8 of 8
  1. #1
    iskender is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2019
    Posts
    4

    Question Forms and Subforms relationships

    Dear Forum members,

    I have form with subform inside (datasheet view). Also i have macro which i run in data entry for main form. This is working as follow:

    Public Sub Form_BeforeInsert(Cancel As Integer)
    Call AuditChanges("PONumberID")
    End Sub

    and work perfectly to main form. However when I install same event procedure for subform, macro is not working



    Please help me
    Thank you in advance
    Iskender

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Please show the code for AuditChanges.
    Is the AuditChanges taken from Martin Green's site?

  3. #3
    iskender is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2019
    Posts
    4
    Dear Moderator,

    Exact - i have picked code from here:

    https://www.fontstuff.com/access/acctut21.htm

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Post 3 was moderated, I'm posting to trigger email notifications.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    iskender,

    There is an issue with the audit program from Martin Green. It does not deal with subforms and it identifies the wrong record for Deletes.
    See this thread for the dialog with PSSMargaret describing the problems and a solution.

    Here is a related thread -similar subject - with some comments that may be helpful.
    https://access-programmers.co.uk/for...ighlight=audit

    Since you have Acc2016, you may want to review this thread on Macros for an alternate approach. The thread was about use of macros, but I mentioned data macros (starting at post #8). I show a sample of an audit trail using data macros.

    Good luck with your project.

  6. #6
    iskender is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2019
    Posts
    4
    Dear Moderator,

    I have tried all 3 links you send me but non of them could help me. Send you example of working file (where AuditTrail works for form but not for subform). Can you please help me to define what is wrong with subforms?

    Thank you
    Iskender
    Attached Files Attached Files

  7. #7
    iskender is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2019
    Posts
    4
    Dear Moderator,

    Kind reminder - could you please review attached from my previous post and let me know what I do wrong? Thank you

  8. #8
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    See this link for the latest info ---database example and word document description. I'm would have thought that the dialog with PSSMargaret mentioned previously would have highlighted some issues with the audit code from fontstuff.
    But, having looked at your database, I see that your relationships are incomplete - not all of your tables are represented; PK's are suspicious. I do not use embedded macros. It is unclear what this database is intended to support. When posting, it is helpful for communication if you supply a description of the business involved to provide context.

    Here is another thread where a poster has issues with the same audit code you are working with.

    Good luck.

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

Similar Threads

  1. Replies: 1
    Last Post: 04-08-2016, 04:55 PM
  2. Replies: 4
    Last Post: 09-29-2015, 01:40 AM
  3. Replies: 1
    Last Post: 03-18-2015, 04:26 PM
  4. Replies: 5
    Last Post: 01-16-2013, 03:48 PM
  5. Replies: 2
    Last Post: 03-14-2011, 07:56 PM

Tags for this Thread

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