Results 1 to 3 of 3
  1. #1
    WCStarks is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Sep 2016
    Posts
    314

    Running refresh macro including an After Update procedure

    I have Office 365 on Windows 10.
    To start off, I have my database in a user defined trusted location. I even have the Macro security setting set to always allow.

    I have a Form Refresh button defined on my form using the Command Wizard. It functions properly, until I add an event procedure for After Update to the form. The event procedure very simply updates a field in the record, based on two other fields in the same record.

    Private Sub Form_AfterUpdate()
    Mem_Name = Surname & ", " & Given_Name


    End Sub

    If I attempt to go to the next record after editing a name field, I am told "You cannot go to that record".
    If, instead, I select the refresh button, I get the following error:
    Macro Name: SCATeam : Refresh: OnClick : Embedded Macro
    Action Name: RunMenuCommand
    Error Number: 2950, Arguments: 18

    And the form no longer functions properly, forcing me to close it and reopen it. Even with the error, the event procedure completes the update.
    If I do not edit a name field, the refresh, or go to next record, both work just fine. If I get rid of the After Update procedure, everything works fine, even when I edit a name field, but, of course, the update of the target field doesn't happen.

    Why is this happening, and how can I get it to work?

  2. #2
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    You need to look at the embedded macro, check it's purpose and quite possibly delete it.
    I would recommend not using embedded macros at all
    You can change options to always use event procedures.
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  3. #3
    NTC is offline VIP
    Windows 10 Access 2013
    Join Date
    Nov 2009
    Posts
    2,392
    it could be:
    * the field's data value itself - being in conflict with the table field value type/parameters
    * the macro
    * when the macro is being triggered

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

Similar Threads

  1. Replies: 3
    Last Post: 10-27-2015, 02:37 PM
  2. Replies: 13
    Last Post: 02-04-2013, 04:08 AM
  3. Running a shell command from a stored procedure.
    By sstrauss87 in forum SQL Server
    Replies: 3
    Last Post: 03-01-2012, 04:39 PM
  4. Running an Update Query from a Macro
    By michaelb in forum Queries
    Replies: 7
    Last Post: 06-02-2011, 09:46 PM
  5. Replies: 3
    Last Post: 10-04-2010, 01:31 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