ACC2: "ODBC-Remote Query Timeout" Deleting Main Form RecordLast reviewed: May 20, 1997Article ID: Q128885 |
The information in this article applies to:
SYMPTOMSAdvanced: Requires expert coding, interoperability, and multiuser skills. When you delete a record on a form that contains a subform, the application seems to stop responding (hang), and then, after the configured ODBC query timeout has passed, you receive the error message "ODBC-remote query timeout expired." At this point, you can choose to accept or to roll back the delete. When you do, the subform is populated with "#NAME?" messages. The subform is not populated correctly until you re-open the main form.
CAUSEThis problem occurs when the following conditions are true:
RESOLUTIONInstead of using the Microsoft Access user interface to delete records, create a button with an SQL pass-through query in its OnClick event procedure to delete the record, as in the following example. NOTE: In the following sample code, an underscore (_) at the end of a line is used as a line-continuation character. Remove the underscore from the end of the line when re-creating this code.
Sub Button1_Click () Dim mydb As Database, myq As QueryDef Set mydb = DBEngine.Workspaces(0).Databases(0) ' Create a temporary QueryDef object that is not saved. Set myq = mydb.CreateQueryDef("") ' Set the ReturnsRecords property to No in order to use the ' Execute method. myq.returnsrecords = False myq.connect ="ODBC; " myq.sql = "delete from Parent _ where keyP='" & forms!aParentForm!keyp & "'" myq.Execute myq.Close forms!aParentForm.Requery End SubThe first part of the code sends an SQL pass-through query to delete the record. The requery removes the deleted record. This code returns the application to the beginning of the form's recordset. If you want the application to return to the position where it was before you deleted the record, you need to add additional code using bookmarks.
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.
|
Additional query words: freeze
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |