Microsoft Access closes when you try to export a table to an Access database (824168)



The information in this article applies to:

  • Microsoft Office Access 2003
  • Microsoft Access 2002

Novice: Requires knowledge of the user interface on single-user computers.
This article applies only to a Microsoft Access project (.adp).

SYMPTOMS

In a Microsoft Access project, when you try to export a table to an Access database (*.mdb) and the table contains fields that have long field names, Microsoft Access closes unexpectedly. You receive the following error message:
Microsoft Office Access has encountered a problem and needs to close.
We are sorry for the inconvenience.

WORKAROUND

To work around this problem, use field names that are shorter.

MORE INFORMATION

The Access database depends on the Microsoft Jet database engine for storage. The Microsoft Jet database engine stores all the objects that are specific to Access, including forms, reports, macros, modules, and commandbars in the system tables for Access in the Microsoft Jet engine database. However, the Microsoft Access project uses Microsoft SQL Server for database storage. Therefore, Access projects are independent of the Microsoft Jet database engine.

Because the Microsoft Jet database engine does not support tables that have long field names (specifically, field names that are greater than 63 characters), exporting tables that have long field names to an Access database is not successful. When you try to import a table that has long field names into an Access database, the import process may fail, and you may receive the following error message in Access 2003:
ODBC--call failed.
[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid column name
<columnName>'.
(#207)


If you use Access 2002, you may receive the following error message:
ODBC--call failed.

Steps to Reproduce the Problem

  1. Start Access.
  2. Open the Northwind sample Access project that is connected to a valid SQL Server database.
  3. In the database window, click Queries under Objects.
  4. In the right pane, double-click Create stored procedure in designer.
  5. In the Add Table dialog box, click Close.
  6. On the View menu, click SQL View.
  7. Paste the following stored procedure, and then save the stored procedure as StoredProcedure1:
    CREATE PROCEDURE StoredProcedure1
    AS
    if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[table_longcolumn]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    drop table [dbo].[table_longcolumn]
    
    CREATE TABLE [dbo].[table_longcolumn] 
    (
    	[aaaaaaaaaabbbbbbbbbbaaaaaaaaaabbbbbbbbbbaaaaaaaaaabbbbbbbbbbaaaa] [char] (50) PRIMARY KEY NOT NULL,
    	[col1] [char] (50),
    	[col2] [int] NULL 
    ) ON [PRIMARY]
    
    RETURN 
    
  8. In the database window, double-click StoredProcedure1 to run the stored procedure.

    Note When you run the StoredProcedure1 stored procedure, a new table is created in the Northwind project. This table is named table_longcolumn.
  9. Right-click the table_longcolumn table, and then click Export.
  10. In the Export Table 'table_longcolumn' To dialog box, click the Access database, and then click Export.
  11. In the Export dialog box, click OK.

    Microsoft Access stops responding and then closes unexpectedly.

Modification Type:MinorLast Reviewed:6/9/2004
Keywords:kbdesign kbDatabase kbProgramming kbExport kberrmsg kbprb KB824168 kbAudDeveloper