ACC2: GPF Using GetChunk Method As Argument for Put StatementID: Q117611
|
Moderate: 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.
The 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.
Create 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.
Microsoft has confirmed this to be a problem in Microsoft Access version 2.0. This problem no longer occurs in Microsoft Access version 7.0.
Function Test ()
Dim d As Database, rs As Recordset
Set d = CurrentDb()
Set rs = d.OpenRecordset("Employees", DB_OPEN_TABLE)
Open rs![Last Name] & ".txt" For Binary As #1
Put #1, , rs![Notes].GetChunk(0, 1000)
Close #1
rs.Close
d.Close
End Function
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
For more information about the Put statement, search for "Put," and then "Put Statement" using the Microsoft Access Help menu.
Additional query words: gpf
Keywords : kberrmsg IntpOle
Version : 2.0
Platform : WINDOWS
Issue type : kbbug
Last Reviewed: April 6, 1999