Microsoft KB Archive/108634

{| = BUG: Hang or GPF in Browse with S Function Code =
 * width="100%"|

ID: Q108634

The information in this article applies to:


 * Microsoft FoxPro for MS-DOS, versions 2.5, 2.5a, 2.5b, 2.6
 * Microsoft FoxPro for Windows, versions 2.5, 2.5a, 2.5b

SYMPTOMS
If the following conditions are present when you are browsing a database, FoxPro for MS-DOS locks up or exits to the MS-DOS prompt and FoxPro for Windows causes a general protection (GP) fault:


 * A character field in the database is 254 characters wide. This is the maximum width allowed for a character field. Widths less than this should not cause the problem.
 * The BROWSE FIELDS command is issued and the character field with the width of 254 has the S function code applied to it. The S function code limits the display width to the number of characters specified in place of .

RESOLUTION
As an alternative to the S function code, use the : clause. For example:

BROWSE FIELDS cno, company :20, contact

STATUS
Microsoft has confirmed this to be a problem in FoxPro versions 2.5, 2.5a, 2.5b, and 2.6 for MS-DOS and FoxPro versions 2.5, 2.5a, and 2.5b for Windows. This problem does not occur in FoxPro version 2.6 for Windows. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

Steps to Reproduce Problem
1. Modify the structure of the CUSTOMER database so that the COMPANY field

is 254 characters wide. The CUSTOMER database can be found in the TUTORIAL subdirectory of the directory where FoxPro is installed. 2. Make sure the CUSTOMER database is in use. 3. Issue the following command in the Command window:

BROWSE FIELDS cno, company :P='@S20', contact

This command will browse the CNO, COMPANY and CONTACT fields in the CUSTOMER database. The COMPANY field should display only 20 characters. If you are running the Standard (16-bit) version of FoxPro for MS-DOS (FOXPRO.EXE), tabbing to the COMPANY field from one of the other fields places the information from that field in the COMPANY field. Scrolling the COMPANY field using the arrow keys causes the information from the previous record to appear in the current record. This behavior is just temporary; it does not permanently change the database. Eventually FoxPro locks up. If you are running the Extended (32-bit) version of FoxPro for MS-DOS (FOXPROX.EXE), tabbing to the COMPANY field either locks up FoxPro or causes FoxPro to exit to MS-DOS. You may also receive the "Abnormal Program Termination: Memory Protection Fault" error message.

If you are running FoxPro for Windows, FoxPro causes a GP fault before the Browse window can be completely displayed.