ACC: Sent Keys Lost If Microsoft Access Yields Processor

Last reviewed: May 14, 1997
Article ID: Q109958
The information in this article applies to:
  • Microsoft Access versions 1.0, 1.1, 2.0

SYMPTOMS

Novice: Requires knowledge of the user interface on single-user computers.

If you use the SendKeys statement in Access Basic to fill a dialog box and Microsoft Access yields the computer's processor to another Windows process before the dialog box appears, the sent characters will be lost.

One situation where this might occur would be filling a report name in the Print dialog box when you are printing a report to a file.

RESOLUTION

To minimize the chance of losing sent keys, make your queries as short as possible. When a query takes a long time to run, Windows has more time to interrupt the task to serve another Windows process. By shortening your queries, you give Windows less time to interrupt.

If this problem occurs when you are printing to a file, try printing directly to the file through your printer driver. If your printer driver supports this, set it to print your report directly to a file instead of using Microsoft Access to do this.

STATUS

Microsoft has confirmed this to be a problem in Microsoft Access versions 1.0, 1.1, and 2.0. This problem no longer occurs in Microsoft Access version 7.0.

MORE INFORMATION

Steps to Reproduce Problem

  1. Set up a Windows printer to print to FILE. In Microsoft Windows 95 open the Printer folder and click on New Printer. Follow the wizard instructions. In Windows 3.x, use the Windows Control Panel, double- click on printers, select or add your printer click Connect. Select FILE from the Ports list and click OK.

  2. Start Microsoft Access and open the sample database Northwind.mdb (In Access 2.0 or earlier, NWIND.MDB.)

  3. Copy the query "Employee Sales by Country" to "Employee Sales by Country Backup". (In Access 2.0 and earlier, this query will be called "Employee Sales by Country (Parameter)")

  4. Open the "Employee Sales by Country" query and remove the parameters from the Shipped Date field in the query grid.

  5. Drag the Employee ID field to the query grid and then type "1" (without the quotation marks) in its Criteria row. Close and save the query.

  6. Create the following new macro and save it as "Print Employee Sales by Country":

          SendKeys
    
             Keystrokes: text.txt
             Wait: No
          SendKeys
             Keystrokes: {enter}
             Wait: No
          OpenReport
             Report: Employee Sales By Country
             Mode: Print
    
    

  7. Set the report "Employee Sales by Country" to print to the printer on port FILE. To do this, in Microsoft Access for Windows, select Page Setup from the File menu. Select the Page tab. Select "Use Specific Printer" and select the printer you set up in step 1. Click OK. In Microsoft Access, version 2.0 or earlier, select Printer Setup from the File menu and select specific printer. Select the printer you set up in Step 1 above and click OK. Save the report.

  8. Run the "Print Employee Sales by Country" macro. In Microsoft Access for Windows 95 or Microsoft Access, version 1.x, the sent keys work correctly. In version 2.0, the sent keys are lost.

  9. Remove the Employee ID field from the query and run the macro again. Note that the sent keys are again lost in Microsoft Access, version 2.0

REFERENCES

For information on setting up a printer in Windows 95, search for "Printer, setting up a printer" using the Windows 95 Help menu.

For more information about setting up a printer, search for "SendKeys action" or "printing, Print dialog box options" using the Microsoft Access 2.0 Help menu.

For more information about setting up a printer, search for "Print Setup" or "Sendkeys" using the Microsoft Access 2.0 Help menu.

For more information about setting up a printer in Microsoft Windows 3.x, press F1 while in the Printer Setup window.


Additional query words: programming timeout
Keywords : kbprint PtrOthr
Version : 1.0 1.1 2.0
Platform : WINDOWS
Hardware : X86
Issue type : kbbug
Resolution Type : kbworkaround


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: May 14, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.