Microsoft KB Archive/101074

From BetaArchive Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Article ID: 101074

Article Last Modified on 1/18/2007



APPLIES TO

  • Microsoft Access 1.0 Standard Edition
  • Microsoft Access 1.1 Standard Edition
  • Microsoft Access 2.0 Standard Edition
  • Microsoft Access 95 Standard Edition
  • Microsoft Access 97 Standard Edition



This article was previously published under Q101074

Moderate: Requires basic macro, coding, and interoperability skills.


SUMMARY

In a Microsoft Access macro, a SendKeys action must precede the DoMenuItem action when you need to send keystrokes to a dialog window. For example, when a DoMenuItem action opens the Print dialog to change a printing parameter, the SendKeys keystrokes remain in the buffer and do not run if the SendKeys action follows the DoMenuItem action.

MORE INFORMATION

Because opening a dialog window suspends a macro, you must execute the SendKeys action before the dialog opens. The following example demonstrates opening the Print dialog. Try running this macro from a button on a form.

In Microsoft Access 97

   Macro Name     Action         Comment
   ---------------------------------------------------------------
   TestSendKeys   SendKeys       Store keystrokes for Print dialog
                  RunCommand     Open Print dialog

   TestSendKeys Actions
   ----------------------------
   SendKeys
      Keystrokes: %g1%t5{ENTER}
      Wait: No
   RunCommand
      Command: Print
                

In Microsoft Access 7.0

   Macro Name     Action         Comment
   ---------------------------------------------------------------
   TestSendKeys   SendKeys       Store keystrokes for Print dialog
                  DoMenuItem     Open Print dialog

   TestSendKeys Actions
   ----------------------------
   SendKeys
      Keystrokes: %g1%t5{ENTER}
      Wait: No
   DoMenuItem
      Menu Bar: Form
      Menu Name: File
      Menu Command: Print
                

In Microsoft Access 1.x and 2.0

   Macro Name     Action         Comment
   ---------------------------------------------------------------
   TestSendKeys   SendKeys       Store keystrokes for Print dialog
                  DoMenuItem     Open Print dialog

   TestSendKeys Actions
   ----------------------------
   SendKeys
      Keystrokes: %p1%t5{ENTER}
      Wait: No
   DoMenuItem
      Menu Bar: Form
      Menu Name: File
      Menu Command: Print
                

REFERENCES

For more information about SendKeys, search the Help Index for "SendKeys action."

For more information about SendKeys keystroke syntax, search the Help Index for "SendKeys statement."

Keywords: kbinfo kbusage KB101074