[AccessD] In a legacy system how control a Vba MsgBox

A.D. Tejpal adtp at airtelmail.in
Thu Jan 28 22:51:21 CST 2010


Ed,

    If there are compelling reasons to enforce automated closing of message box, my sample db named Form_MsgBoxAutoClick might be of interest to you. It is in access 2000 file format and is available at Rogers Access Library. Link - 
http://www.rogersaccesslibrary.com/forum/forum_topics.asp?FID=45

    This sample db demonstrates automatic closing of message box after a specified time delay (which can be set as desired), if the user fails to respond in the given time span. It makes use of API calls FindWindow and DestroyWindow via temporary activation of form's timer. On closing the message box, form's timer gets automatically disabled.

    An alternative solution based upon SendKeys is also demonstrated - just for academic interest (Main solution based upon API calls is to be preferred).

Best wishes,
A.D. Tejpal
------------

  ----- Original Message ----- 
  From: Edward Zuris 
  To: accessd at databaseadvisors.com 
  Sent: Friday, January 29, 2010 01:09
  Subject: [AccessD] In a legacy system how control a Vba MsgBox


   Dear AccessD Forum
   
   I am doing a little automation work within a legacy
   environment.
   
   From inside some VBA code, a form is opened, given some
   data, where buttons and controls are clicked.
   
   The opened form, ft001CreateTasks, has a MsgBox asking
   a Yes/No question.
   
   What kind of handle do I use to click the YES button
   on the message box modal form ?
   
   Or are there some other way of tackling this issue ?
   
   Thanks.
   
   Sincerely,
   Ed Zuris.
   

      ====================================================
                   Example Vba Code snippet
      ====================================================
   
      strVar = ""
      DoCmd.OpenForm "ft001CreateTasks", , , strVar
   
      strVar = "Rake Yard"
   
      Forms("ft001CreateTasks").cboTaskType.Value = strVar
   
      Call Forms("ft001CreateTasks").cboTaskType_Click
   
      . . . . now a message box open on the form . . . . . 

      ====================================================
      ====================================================


More information about the AccessD mailing list