Microsoft KB Archive/192143

= BUG: Data Control NoMatch Equals True Returns Error =

Article ID: 192143

Article Last Modified on 1/8/2003

-

APPLIES TO


 * Microsoft Visual Basic 5.0 Enterprise Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q192143



SYMPTOMS
When the NoMatch method of the Data Control returns "True," the Seek method will report a run-time error "No Current Record."



RESOLUTION
The user can work around this problem by trapping the Data Control's error event and repositioning to an existing record after the seek failure.



STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.



Steps to Reproduce Behavior
 Create a Standard EXE in Visual Basic. Form1 is created by default. Place a DataControl, Label, and CommandButton on the form.  Set the following Properties of the controls: DataConrol(Data1) [DatabaseName]  :Biblio.mdb [RecordsetType] :0 - Table [RecordSource]  :Authors

Label(Label1) [DataSource]    :Data1 [DataField]     :Author

  Add the following code to the CommandButton's Click event: Private Sub Command1_Click

Data1.Recordset.Index = "PrimaryKey" Data1.Recordset.Seek "=", 0    'so that NoMatch=True Print Data1.Recordset.NoMatch

End Sub

 Press the F5 key to execute code, and note that the "No Current Record" error is returned on the Seek method.</ol>

<div class="references_section">