Results 1 to 5 of 5
  1. #1
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615

    Problems with the Run command

    I have an application in which if users double-click on a text box, a "Zoom Box" form pops up to allow the entry of multiple lines or a paragraph of text. When the zoom-box form closes, the original control which was double-clicked is updated. This all works just fine.



    However, because the text is updated using VBA, the After Update event of the control does not fire, and I need to have it run. In my module to open the zoom-box (which is openened in dialog mode), I have this after the form is closed:

    CMD = "Forms![" & Screen.ActiveForm.Name & "]." & Screen.ActiveControl.Name & "_AfterUpdate"

    which for example results in the variable CMD being set (correctly) to:

    "Forms![Edit_Job_Working_Conditions_Detail].WorkEnvironment_AfterUpdate"

    Now, if I do Run (CMD), access gives an error that it cannot find the procedure, but if I put

    Forms![Edit_Job_Working_Conditions_Detail].WorkEnvironment_AfterUpdate

    as an explicit command to test - in the same place as the Run - it works fine and runs the procedure as it should.

    Because the zoombox procedure is called from many forms and many controls, it needs to be variable.

    Any thoughts on why the explicit command works, but using Run does not?

    Thanks

    John

  2. #2
    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,847
    What exactly is this
    Now, if I do Run (CMD),

  3. #3
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    It's the Application.run method. ("Application" is assumed if not specified).

    From MS Access help:

    You can use the Run method to carry out a specified Microsoft Access or user-defined Function or Sub procedure.

  4. #4
    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,847
    Try making the afterUpdate a Public function rather than Private.

    Best guess at the moment

  5. #5
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Already done - otherwise the explict call wouldn't work either. And the form is open when the procedure runs.

    Thanks

    John

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

Similar Threads

  1. IIF Problems
    By suverman in forum Queries
    Replies: 3
    Last Post: 05-23-2011, 02:22 AM
  2. problems please help
    By stryder09 in forum Access
    Replies: 1
    Last Post: 02-15-2011, 02:24 PM
  3. Replies: 1
    Last Post: 07-27-2010, 02:27 PM
  4. Several problems
    By Bergh in forum Access
    Replies: 1
    Last Post: 05-30-2010, 03:56 AM
  5. OLE problems how to fix
    By miziri in forum Access
    Replies: 7
    Last Post: 04-29-2010, 06:18 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