Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ADO - Recordset.Find() problem
Message
De
02/11/1999 17:52:58
 
 
À
02/11/1999 16:59:26
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Divers
Thread ID:
00285771
Message ID:
00285807
Vues:
19
>I am trying to use ADO as a substitute for VFP remote views for data entry. All of the textbox controlsources will point to the form's ADO recordset object (ex: "thisform.ors.fields('vendornum').value" ). So far the form instantiates fine, the recordset objects gets created and loaded, and I can navigate top/bottom/next/previous using the native recordset methods. But when I try to do a Find() I get the following error:
>
>"OLE IDispatch exception code 0 from ADODB.Field: Either BOF or EOF is True, or the current record has been deleted; the operation requested by the application requires a current record..."
>
>The error SEEMS to be related to binding the recordset to controls (that's my SWAG, anyway). Does anyone have any experience with doing this? FYI I'm trying this with a dynamic server-side cursor; I tried the same thing with a static cursor with the same results.
>
>Any help will be greatly appreciated.
You should bookmark the current record before doing a find and if the search criteria is not met then go back to that record. If there is no match the record pointer goes to EOF and you know what happens after that.
myBookM = oRS.Bookmark
thisform.oRS.MoveFirst
thisform.oRS.Find "description Like '" + Alltrim(myCriteria) + "*'"
If thisform.oRS.EOF Then
    MessageBox("No matches with this criteria")
    thisform.oRS.Bookmark = myBookM
End If
PS Note that not all ADO cursor types support bookmarks or the .Movefirst method.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform