Microsoft KB Archive/79883

= &quot;Field Statement Active&quot; (Error 56) on Basic PUT Statement =

Article ID: 79883

Article Last Modified on 8/16/2005

-

APPLIES TO


 * Microsoft QuickBasic 4.5 for MS-DOS
 * Microsoft BASIC Professional Development System 7.0
 * Microsoft BASIC Professional Development System 7.1

-



This article was previously published under Q79883



SUMMARY
Error 56, &quot;Field Statement Active,&quot; will occur on a PUT statement if you attempt to PUT a variable DIMensioned as a TYPE record structure, to a RANDOM file for which there is an active FIELD statement.

If a file has been FIELDed, you must use the FIELD variable(s) to PUT or GET information to or from the file. To use a TYPE variable, you must first CLOSE the file and then reOPEN it.

This information applies to Microsoft QuickBasic version 4.5 for MS-DOS and Microsoft Basic Professional Development System (PDS) versions 7.0 and 7.1 for MS-DOS and MS OS/2.



MORE INFORMATION
If you want to use the FIELD statement and a TYPE structure at the same time, the file must be closed and reopened when you want to switch between using the FIELD statement and the TYPE structure.

Code Example
' This program will give the error message &quot;Field Statement ' Active&quot; on the PUT statement

TYPE putType s AS STRING * 12 END TYPE

DIM yoke AS putType

OPEN &quot;thefile.txt&quot; FOR RANDOM AS #1 FIELD #1, 12 AS x$                     'FIELD active

LSET x$ = &quot;nirvana&quot; PUT #1                         'PUT using FIELD variable

yoke.s = &quot;soundgarden&quot;

' Take out remarks on next two Basic lines to allow program to ' run, otherwise error 56 will occur on the next PUT: ' CLOSE #1 ' OPEN &quot;thefile&quot; FOR RANDOM AS #1 '(closing and reopening file disables FIELD)

PUT #1,, yoke CLOSE END

Additional query words: QuickBas BasicCom 4.50 7.00 7.10

Keywords: KB79883

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.