Results 1 to 6 of 6
  1. #1
    Nadine67 is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jul 2015
    Posts
    55

    Compile Error: Argument not optional

    Hello and thank your for your attention



    Windows XP
    Access 2007
    VBA knowledge limited

    I have followed Martin Green's steps (fontstuff) for creating an audit trail and am getting a compile error when I check my code.

    This is my code and the error highlights 'Call AuditChanges' as the problem.

    Any help would be greatly appreciated.

    Private Sub Form_BeforeUpdate(Cancel As Integer)
    If Not Me.NewRecord Then
    Call AuditChanges("ImprovementID")

    End Sub

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    Need to see the code for AuditChanges sub. What arguments does it require?

    Could post link to Martin Green's example code.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,850

  4. #4
    Nadine67 is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jul 2015
    Posts
    55
    http://www.fontstuff.com/access/acctut21.htm

    Thank you June!

    I used option 3 (exclude new records) with option 4.

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    If you mean Listing 4, that routine requires 2 arguments. The one you have not provided a parameter for is UserAction. The procedure differentiates between EDIT action and all others. So your call needs to be:

    Call AuditChanges("ImprovementID", "EDIT")

    or

    Call AuditChanges("ImprovementID", "")
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    Nadine67 is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jul 2015
    Posts
    55
    Hello June

    Thank you very much for your help. Your 'fix' has made my audit trail work. I have done a few test runs and bravo.

    Have a great day June.

    Nadine

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

Similar Threads

  1. Replies: 4
    Last Post: 08-08-2013, 12:10 PM
  2. error argument not optional
    By slimjen in forum Programming
    Replies: 10
    Last Post: 03-20-2013, 09:31 PM
  3. Compile Error: Argument not optional
    By tariq1 in forum Programming
    Replies: 4
    Last Post: 08-11-2012, 01:06 PM
  4. Replies: 7
    Last Post: 11-17-2011, 02:56 PM
  5. Compile Error: Argument Not Optional
    By bg18461 in forum Access
    Replies: 1
    Last Post: 12-01-2010, 08:47 AM

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