ACC2: GPF Using List Box Fill Function with Requery MethodID: Q117615
|
When you fill a list box using an Access Basic function, and the function returns a static variable upon receiving the close code (8), and you then use the Requery method to requery the list box, you receive a general protection (GP) fault.
The temporary string created by the list box fill function is not freed, and conflicts with another variable used internally by Microsoft Access.
Use one of the following techniques to work around this problem:
Microsoft has confirmed this to be a problem in Microsoft Access version 2.0. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
Option Compare Database 'Use database order for string _
comparisons.
Dim iTotTables As Integer
Dim My_CurrDB As Database
Dim TableList2() As String
Dim iTotFlds As Integer
Dim FieldList() As wlib_FldInfo
Function FillTables (fld As Control, handle As Long, lRow As _
Long, lCol As Long, iMsg As Integer) As Variant
Static returnval As Variant
' If you change the above line to the following the error
' will not occur:
' Dim returnval As Variant
Select Case iMsg
Case LB_INITIALIZE
returnval = -1&
Case LB_OPEN
returnval = Timer
Case LB_GETROWCOUNT
returnval = iTotTables
Case LB_GETCOLUMNCOUNT
returnval = 1
Case LB_GETCOLUMNWIDTH
returnval = -1&
Case LB_GETVALUE
returnval = TableList2(lRow + 1)
Case LB_GETFORMAT
Case LB_CLOSE
Case LB_END
End Select
FillTables = returnval
End Function
Command button:
Name: Button0
Caption: Requery Table List
List box:
Name: Field1
RowSourceType: FillTables
Sub Button0_Click ()
Set My_CurrDB = DBEngine.Workspaces(0).Databases(0)
iTotTables = wlib_GetObjList(My_CurrDB, A_TABLE, TableList2(),_
False, &HFFFFFFFF)
Me!Field1.Requery
End Sub
General Protection Fault in MSABC200.DLL at 000B:07E1
For more information about using Access Basic code to fill a list box, search for "filling list boxes/combo boxes" then "Filling a List Box or Combo Box Using an Access Basic Function" using the Microsoft Access Help menu.
Additional query words: programming gpf
Keywords : kberrmsg kbprg
Version : 2.0
Platform : WINDOWS
Issue type : kbbug
Last Reviewed: April 5, 1999