ACC1x: Error Message Using Access Basic to Import File |
Q109952
The information in this article applies to:
- Microsoft Access versions 1.0, 1.1
SYMPTOMS
You receive an "Application Error" message or a general protection (GP) fault when you use Access Basic code to import files into Microsoft Access.
CAUSE
This problem occurs if you use the DoMenuItem action to open the Import dialog box.
RESOLUTION
Use the TransferDatabase, TransferSpreadsheet, or TransferText action instead of the DoMenuItem action.
STATUS
Microsoft has confirmed this to be a problem in Microsoft Access versions 1.0 and 1.1. This problem no longer occurs in Microsoft Access version 2.0.
MORE INFORMATION
Steps to Reproduce Problem
NOTE: This article assumes that you are familiar with Access Basic and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information on Access Basic, please refer to the "Introduction to Programming" manual.
Create a module with the following line in the Declarations section:
Option Explicit
Create and run the following sample function:
Function TestImport() DoCmd DoMenuItem 1,0,5 End Function
The error message will occur as soon as you choose the OK button in the Import dialog box.
The following sample function demonstrates how to use the TransferText action to import a Text (Delimited) file:
Create a module with the following line in the Declarations section:
Option Explicit
Create and then run the following sample function:
Function ImpText() DoCmd TransferText A_ImportDelim,,"ATABLE","C:\TEST.TXT" End Function
References
Microsoft Access "Language Reference," version 1.1, pages 479-481
Additional query words: gpf transfer text
Keywords : kberrmsg kbinterop
Issue type : kbbug
Technology :
Last Reviewed: November 4, 2000 |