Microsoft KB Archive/126942

{|
 * width="100%"|

PRJ4: Errors Using Open From and Save To Database Commands

 * }

Q126942

-

The information in this article applies to:


 * Microsoft Project for Windows, version 4.0

-

SYMPTOMS
When you use the Save To Database or Open From Database commands to save a file to or open a file from a Microsoft Access database, you may experience the following unexpected behavior:

  When you use the Save To Database command, one of two things happens: either incorrect data is written to the Microsoft Access database, or the command fails and you receive the following error message in Microsoft Access:

Data buffer doesn't match column size

  If Save To Database succeeds in writing bad data to the Microsoft Access database, and you choose the Open From Database command in Microsoft Project, you may receive an error message similar to one of the following when Microsoft Project attempts to read this bad data

. . . not valid

-or-

Field exceeds maximum size. ..



CAUSE
This problem occurs for one of two reasons:


 * The contents of a Microsoft Project text field (such as Name, Notes, or Text1) includes a quotation mark, followed immediately by a comma, or begins with a quotation mark but does not end with a quotation mark.
 * The Microsoft Access database is corrupted or its table definitions have been altered.

WORKAROUNDS
Method 1: If a project has the quotation mark problem described above, the only solution is to change the offending entries in the project. The simplest way to avoid quotation mark problems is to avoid using the quotation mark character. The apostrophe character could be used instead.

Note that attempting to save the project to a new database will not correct this problem.

Method 2: If the Microsoft Access database is corrupted or if its table definitions have been altered, save the original project to a new or different Microsoft Access database by clearing the contents of the Text1,Text2,Text3, and Text4 fields of the project summary task, or by renaming, moving, or deleting the original Access database.

STATUS
Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article.

MORE INFORMATION
The Save To Database command saves the active project as a temporary MPX file, and then parses the MPX file and writes data to a Microsoft Access database. When Microsoft Project saves an MPX file, any quotation mark in a project field is replaced by two quotation marks in the corresponding MPX field. If a project field contains commas, the entire MPX field is surrounded by an extra pair of quotation marks. When the Save To Database command parses the MPX records, it does not correctly interpret a pair of quotation marks that represents a single quotation mark. If an MPX text type field starts with a quotation mark, Save To Database incorrectly determines the end of the field by searching for a quotation mark followed immediately by a comma or the end of the record.

If the contents of a Microsoft Project text field includes a quotation mark followed immediately by a comma, Save To Database incorrectly splits it into two Microsoft Access fields, shifting other project fields into the wrong fields in Microsoft Access. It may also write records out of order. The example below shows the contents of the Text1 field in a project, how it is represented in the MPX task record, and how Save To Database incorrectly splits it (three dots represents omitted data):

  MS Project      MPX                             MS Access Text1          Part of task record             Text1   Text2 -  "a",b           ...,"""a"",b",... ""a"   b"   "c","d"         ...,"""c"",""d""",... ""c"   "d""

If a Microsoft Project text field starts with a quotation mark, does not end with a quotation mark, and contains no commas, then too many characters are written to the Microsoft Access field. The example below shows the task Name field in a project, how it is represented in the MPX task record, and how Save To Database incorrectly writes too many characters to the task Name field in Access (three dots represents omitted data):

  Task Name in project:   "a    Part of MPX record:     ...,""a,,0,0,0,0,0,0,1,1,...,0h    Name field in Access    ""a,,0,0,0,0,0,0,1,1,...,0h If Save To Database tries to write more characters to a Microsoft Access field than the field allows, then it fails with the Microsoft Access error message:

Data buffer doesn't match column size

If Save To Database succeeds in writing bad data to the Access database, then errors may occur later when you use Open from Database. The Open from Database command creates a temporary MPX file from the Access database and then Microsoft Project opens it. If the wrong kind of data for a field is read from the MPX file, then a Microsoft Project message of the form ". . . not valid" occurs. For example, if bad data is read for the Flag1 field from task record 2, column 5 of the MPX file, then the following Microsoft Project error message occurs:

Row 2 Column 5

Value not valid; must be Yes or No

Choose Yes to continue messages, No to stop

messages, Cancel to stop import.

Depending on the offending field, the second line in the message could be "Predecessor list not valid," "Date not valid," "Work not valid," or other similar statements. If a field in the MPX file contains too much data, then an additional message may occur. For example, if a field in line 17 of the MPX file contains too many characters, then the following Microsoft Project error message occurs (after choosing Yes to all of the above messages or by choosing No to one of them):

Field exceeds maximum size and has been truncated (line #17). It may no longer be valid.

Additional query words: Data buffer doesn t match column size

Keywords : kberrmsg

Issue type : kbbug

Technology :