Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to determine if field entry is unique?
Message
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01143260
Message ID:
01143261
Views:
6
This message has been marked as the solution to the initial question of the thread.
Try
* VFP9 only
SELECT * FROM  mytable ;
	WITH (Buffering = .T.) ;
 	WHERE <New User Entry> ;
 	TO SCREEN NOCONSOLE 
 	
IF _TALLY > 1
  * Duplicate

*Any VFP version
COUNT FOR <New User Entry> to nCount
GOTO (nCurrenRecno)
IF nCount > 1
  * Duplicate

>I am refactoring old code (written in VFP 5) that check if user entry is unique in a table.
>
>The table has NO index tags and it is a fairly small table (up to 100 records). The table is opened with Buffering 5.
>
>My code is quire complex. Here is a summary of what it does:
>
>1. Open the same table AGAIN
>2. SET FILTER TO THE RECNO() <> nCurrenRecno
>3. LOCATE FOR New User Entry.
>4. If not found, the entry is unique.
>
>Is there a simpler method to do it in VFP 9 SP1? Without, maybe, opening the table again?
>
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform