ACC2: GPF Using GetChunk Method As Argument for Put StatementLast reviewed: May 14, 1997Article ID: Q117611 |
The information in this article applies to:
SYMPTOMSModerate: Requires basic macro, coding, and interoperability skills. When you use the GetChunk method in the third parameter of a Put statement, you may receive a general protection (GP) fault.
CAUSEThe third parameter of the Put statement requires a variable name. You cannot directly use a method (such as the GetChunk method) as a statement argument.
RESOLUTIONCreate an intermediate variable, assign the value returned from the GetChunk method to this variable, and then use the variable as the third parameter of the Put statement. This technique is demonstrated in the "Workaround" section later in this article.
STATUSMicrosoft has confirmed this to be a problem in Microsoft Access version 2.0. This problem no longer occurs in Microsoft Access version 7.0.
MORE INFORMATION
Steps to Reproduce ProblemWARNING: Following these steps will cause a general protection fault on your computer. Make sure you save and close any open work on your computer before following these steps.
WorkaroundThe following sample function is a modified version of the Test() function above. This version of the Test() function will generate a text file with a portion of the Notes memo field from the first record of the Employees table. The name of the text file is determined by the first eight characters of the Last Name field. Note that in this version, the Put statement uses the variable X for the third parameter, which is set equal to the GetChunk method.
Function test () Dim d As Database, rs As Recordset Dim x As String Set d = CurrentDb() Set rs = d.OpenRecordset("Employees", DB_OPEN_TABLE) Open rs![Last Name] & ".txt" For Binary As #1 x = rs![Notes].GetChunk(0, 1000) Put #1, , x Close #1 rs.Close d.Close End Function REFERENCESFor more information about the Put statement, search for "Put," and then "Put Statement" using the Microsoft Access Help menu.
|
Additional query words: gpf
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |