Information générale
Catégorie:
Codage, syntaxe et commandes
>Hi,
>
>I have some code that attempts to retrieve the nearest matching record using the criteria that the user enters. Unfortunately, VFP is not reacting the way I'm expecting it to.
>
>I have a three character field which is the primary key field in the table. If the user enters the first character and performs the search, it should retrieve the a record with the first character. However, what's happening instead is that it returns the last record. I'll provide an example that will better explain this:
>
>The table holds the following test data:
>CAN
>DH2
>DUH
>EUR
>PND
>RUB
>UDB
>USD
>
>
>The code that I'm using is as follows:
>
>LOCAL lnRecNo
>
>lnRecNo = RECNO("CurrMast")
>GO TOP
>SET EXACT OFF
>SEEK UPPER(ALLTRIM(THISFORM.txtCurrID.Value))
>SET EXACT ON
>
>IF NOT FOUND("CurrMast")
> GO lnRecNo IN CurrMast
> MsgBox("Currency was not found.",,,16)
> RETURN .F.
>ENDIF
>
>When I attempt to search for "D" in the textbox, the returning record is USD instead of DH2 or DUH. If I do a search for "DH" it'll still return USD. If I do a search for "DU" it'll return DUH. If I do a search for "C", it'll return CAN. What am I doing wrong?
>
>Thanks in advance,
How is the table ordered?
Is there any filters on the table?
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement